#NEWLINE# @ synchronized ( 'lock' ) #NEWLINE# def queue_declare( self , queue = '' , passive = False , durable = False , exclusive = False , auto_delete = True , nowait = False , arguments = None ) : #NEWLINE# #INDENT# "Declare queue, create if needed\n\n        This method creates or checks a queue. When creating a new queue the client can specify\n        various properties that control the durability of the queue and its contents, and the level\n        of sharing for the queue. A tuple containing the queue name, message count, and consumer\n        count is returned, which is essential for declaring automatically named queues.\n\n        * If `passive` is specified, the server state is not modified (a queue will not be\n          declared), and the server only checks if the specified queue exists and returns its\n          properties. If the queue does not exist, the server must raise a 404 NOT FOUND channel\n          exception.\n        * The server must create a default binding for a newly-created queue to the default\n          exchange, which is an exchange of type 'direct'.\n        * Queue names starting with 'amq.' are reserved for use by the server. If an attempt is\n          made to declare a queue with such a name, and the `passive` flag is disabled, the server\n          must raise a 403 ACCESS REFUSED connection exception.\n        * The server must raise a 405 RESOURCE LOCKED channel exception if an attempt is made to\n          access a queue declared as exclusive by another open connection.\n        * The server must ignore the `auto_delete` flag if the queue already exists.\n\n        RabbitMQ supports the following useful additional arguments:\n\n        * x-max-length (int): maximum queue size\n            * Queue length is a measure that takes into account ready messages, ignoring\n              unacknowledged messages and message size. Messages will be dropped or dead-lettered\n              from the front of the queue to make room for new messages once the limit is reached.\n\n        :param str queue: queue name; leave blank to let the server generate a name automatically\n        :param bool passive: do not create queue; client can use this to check whether a queue\n            exists\n        :param bool durable: mark as durable (remain active after server restarts)\n        :param bool exclusive: mark as exclusive (can only be consumed from by this connection);\n            implies `auto_delete`\n        :param bool auto_delete: auto-delete queue when all consumers have finished using it\n        :param bool nowait: if set, the server will not respond to the method and the client\n            should not wait for a reply\n        :param dict arguments: exchange declare arguments\n        :raise NotFound: if `passive` is enabled and the queue does not exist\n        :raise AccessRefused: if an attempt is made to declare a queue with a reserved name\n        :raise ResourceLocked: if an attempt is made to access an exclusive queue declared by\n            another open connection\n        :return: queue_declare_ok_t(queue, message_count, consumer_count), or None if `nowait`\n        :rtype: queue_declare_ok_t or None\n        " #NEWLINE# arguments = ( arguments or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# args = AMQPWriter ( ) #NEWLINE# args . write_short ( 0 ) #NEWLINE# args . write_shortstr ( queue ) #NEWLINE# args . write_bit ( passive ) #NEWLINE# args . write_bit ( durable ) #NEWLINE# args . write_bit ( exclusive ) #NEWLINE# args . write_bit ( auto_delete ) #NEWLINE# args . write_bit ( nowait ) #NEWLINE# args . write_table ( arguments ) #NEWLINE# self . _send_method ( Method ( spec . Queue . Declare , args ) ) #NEWLINE# if ( not nowait ) : #NEWLINE# #INDENT# return self . wait ( spec . Queue . DeclareOk )