desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'This method allows a client to reject one or more incoming messages.
It can be used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
:param integer delivery-tag: int/long The server-assigned delivery tag
:param bool multiple: If set to True, the delivery tag is t... | def basic_nack(self, delivery_tag=None, multiple=False, requeue=True):
| if (not self.is_open):
raise exceptions.ChannelClosed()
return self._send_method(spec.Basic.Nack(delivery_tag, multiple, requeue))
|
'Publish to the channel with the given exchange, routing key and body.
For more information on basic_publish and what the parameters do, see:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish
:param exchange: The exchange to publish to
:type exchange: str or unicode
:param routing_key: The routing key to ... | def basic_publish(self, exchange, routing_key, body, properties=None, mandatory=False, immediate=False):
| if (not self.is_open):
raise exceptions.ChannelClosed()
if immediate:
LOGGER.warning('The immediate flag is deprecated in RabbitMQ')
if isinstance(body, unicode_type):
body = body.encode('utf-8')
properties = (properties or spec.BasicProperties())
self._send... |
'Specify quality of service. This method requests a specific quality
of service. The QoS can be specified for the current channel or for all
channels on the connection. The client can request that messages be sent
in advance so that when the client finishes processing a message, the
following message is already held lo... | def basic_qos(self, callback=None, prefetch_size=0, prefetch_count=0, all_channels=False):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Basic.Qos(prefetch_size, prefetch_count, all_channels), callback, [spec.Basic.QosOk])
|
'Reject an incoming message. This method allows a client to reject a
message. It can be used to interrupt and cancel large incoming messages,
or return untreatable messages to their original queue.
:param integer delivery-tag: int/long The server-assigned delivery tag
:param bool requeue: If requeue is true, the server... | def basic_reject(self, delivery_tag, requeue=True):
| if (not self.is_open):
raise exceptions.ChannelClosed()
if (not is_integer(delivery_tag)):
raise TypeError('delivery_tag must be an integer')
return self._send_method(spec.Basic.Reject(delivery_tag, requeue))
|
'This method asks the server to redeliver all unacknowledged messages
on a specified channel. Zero or more messages may be redelivered. This
method replaces the asynchronous Recover.
:param callable callback: Callback to call when receiving
Basic.RecoverOk
:param bool requeue: If False, the message will be redelivered ... | def basic_recover(self, callback=None, requeue=False):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Basic.Recover(requeue), callback, [spec.Basic.RecoverOk])
|
'Invoke a graceful shutdown of the channel with the AMQP Broker.
If channel is OPENING, transition to CLOSING and suppress the incoming
Channel.OpenOk, if any.
:param int reply_code: The reason code to send to broker
:param str reply_text: The reason text to send to broker
:raises ChannelClosed: if channel is already c... | def close(self, reply_code=0, reply_text='Normal shutdown'):
| if self.is_closed:
raise exceptions.ChannelClosed(('Already closed: %s' % self))
if self.is_closing:
raise exceptions.ChannelAlreadyClosing(('Already closing: %s' % self))
LOGGER.info('Closing channel (%s): %r on %s', reply_code, reply_text, self)
for consumer_... |
'Turn on Confirm mode in the channel. Pass in a callback to be
notified by the Broker when a message has been confirmed as received or
rejected (Basic.Ack, Basic.Nack) from the broker to the publisher.
For more information see:
http://www.rabbitmq.com/extensions.html#confirms
:param callable callback: The callback for ... | def confirm_delivery(self, callback=None, nowait=False):
| self._validate_channel_and_callback(callback)
if (not (self.connection.publisher_confirms and self.connection.basic_nack)):
raise exceptions.MethodNotImplemented('Not Supported on Server')
if (callback is not None):
self.callbacks.add(self.channel_number, spec.Basic.Ack, callback, F... |
'Property method that returns a list of currently active consumers
:rtype: list'
| @property
def consumer_tags(self):
| return dictkeys(self._consumers)
|
'Bind an exchange to another exchange.
:param callable callback: The callback to call on Exchange.BindOk; MUST
be None when nowait=True
:param destination: The destination exchange to bind
:type destination: str or unicode
:param source: The source exchange to bind to
:type source: str or unicode
:param routing_key: Th... | def exchange_bind(self, callback=None, destination=None, source=None, routing_key='', nowait=False, arguments=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Exchange.Bind(0, destination, source, routing_key, nowait, (arguments or dict())), callback, ([spec.Exchange.BindOk] if (nowait is False) else []))
|
'This method creates an exchange if it does not already exist, and if
the exchange exists, verifies that it is of the correct and expected
class.
If passive set, the server will reply with Declare-Ok if the exchange
already exists with the same name, and raise an error if not and if the
exchange does not already exist,... | def exchange_declare(self, callback=None, exchange=None, exchange_type='direct', passive=False, durable=False, auto_delete=False, internal=False, nowait=False, arguments=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Exchange.Declare(0, exchange, exchange_type, passive, durable, auto_delete, internal, nowait, (arguments or dict())), callback, ([spec.Exchange.DeclareOk] if (nowait is False) else []))
|
'Delete the exchange.
:param callable callback: The function to call on Exchange.DeleteOk;
MUST be None when nowait=True.
:param exchange: The exchange name
:type exchange: str or unicode
:param bool if_unused: only delete if the exchange is unused
:param bool nowait: Do not wait for an Exchange.DeleteOk'
| def exchange_delete(self, callback=None, exchange=None, if_unused=False, nowait=False):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Exchange.Delete(0, exchange, if_unused, nowait), callback, ([spec.Exchange.DeleteOk] if (nowait is False) else []))
|
'Unbind an exchange from another exchange.
:param callable callback: The callback to call on Exchange.UnbindOk;
MUST be None when nowait=True.
:param destination: The destination exchange to unbind
:type destination: str or unicode
:param source: The source exchange to unbind from
:type source: str or unicode
:param ro... | def exchange_unbind(self, callback=None, destination=None, source=None, routing_key='', nowait=False, arguments=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Exchange.Unbind(0, destination, source, routing_key, nowait, arguments), callback, ([spec.Exchange.UnbindOk] if (nowait is False) else []))
|
'Turn Channel flow control off and on. Pass a callback to be notified
of the response from the server. active is a bool. Callback should
expect a bool in response indicating channel flow state. For more
information, please reference:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#channel.flow
:param callable callbac... | def flow(self, callback, active):
| self._validate_channel_and_callback(callback)
self._on_flowok_callback = callback
self._rpc(spec.Channel.Flow(active), self._on_flowok, [spec.Channel.FlowOk])
|
'Returns True if the channel is closed.
:rtype: bool'
| @property
def is_closed(self):
| return (self._state == self.CLOSED)
|
'Returns True if client-initiated closing of the channel is in
progress.
:rtype: bool'
| @property
def is_closing(self):
| return (self._state == self.CLOSING)
|
'Returns True if the channel is open.
:rtype: bool'
| @property
def is_open(self):
| return (self._state == self.OPEN)
|
'Open the channel'
| def open(self):
| self._set_state(self.OPENING)
self._add_callbacks()
self._rpc(spec.Channel.Open(), self._on_openok, [spec.Channel.OpenOk])
|
'Bind the queue to the specified exchange
:param callable callback: The callback to call on Queue.BindOk;
MUST be None when nowait=True.
:param queue: The queue to bind to the exchange
:type queue: str or unicode
:param exchange: The source exchange to bind to
:type exchange: str or unicode
:param routing_key: The rout... | def queue_bind(self, callback, queue, exchange, routing_key=None, nowait=False, arguments=None):
| self._validate_channel_and_callback(callback)
replies = ([spec.Queue.BindOk] if (nowait is False) else [])
if (routing_key is None):
routing_key = queue
return self._rpc(spec.Queue.Bind(0, queue, exchange, routing_key, nowait, (arguments or dict())), callback, replies)
|
'Declare queue, create if needed. This method creates or checks a
queue. When creating a new queue the client can specify various
properties that control the durability of the queue and its contents,
and the level of sharing for the queue.
Leave the queue name empty for a auto-named queue in RabbitMQ
:param callable ca... | def queue_declare(self, callback, queue='', passive=False, durable=False, exclusive=False, auto_delete=False, nowait=False, arguments=None):
| if queue:
condition = (spec.Queue.DeclareOk, {'queue': queue})
else:
condition = spec.Queue.DeclareOk
replies = ([condition] if (nowait is False) else [])
self._validate_channel_and_callback(callback)
return self._rpc(spec.Queue.Declare(0, queue, passive, durable, exclusive, auto_del... |
'Delete a queue from the broker.
:param callable callback: The callback to call on Queue.DeleteOk;
MUST be None when nowait=True.
:param queue: The queue to delete
:type queue: str or unicode
:param bool if_unused: only delete if it\'s unused
:param bool if_empty: only delete if the queue is empty
:param bool nowait: D... | def queue_delete(self, callback=None, queue='', if_unused=False, if_empty=False, nowait=False):
| replies = ([spec.Queue.DeleteOk] if (nowait is False) else [])
self._validate_channel_and_callback(callback)
return self._rpc(spec.Queue.Delete(0, queue, if_unused, if_empty, nowait), callback, replies)
|
'Purge all of the messages from the specified queue
:param callable callback: The callback to call on Queue.PurgeOk;
MUST be None when nowait=True.
:param queue: The queue to purge
:type queue: str or unicode
:param bool nowait: Do not expect a Queue.PurgeOk response'
| def queue_purge(self, callback=None, queue='', nowait=False):
| replies = ([spec.Queue.PurgeOk] if (nowait is False) else [])
self._validate_channel_and_callback(callback)
return self._rpc(spec.Queue.Purge(0, queue, nowait), callback, replies)
|
'Unbind a queue from an exchange.
:param callable callback: The callback to call on Queue.UnbindOk
:param queue: The queue to unbind from the exchange
:type queue: str or unicode
:param exchange: The source exchange to bind from
:type exchange: str or unicode
:param routing_key: The routing key to unbind
:type routing_... | def queue_unbind(self, callback=None, queue='', exchange=None, routing_key=None, arguments=None):
| self._validate_channel_and_callback(callback)
if (routing_key is None):
routing_key = queue
return self._rpc(spec.Queue.Unbind(0, queue, exchange, routing_key, (arguments or dict())), callback, [spec.Queue.UnbindOk])
|
'Commit a transaction
:param callable callback: The callback for delivery confirmations'
| def tx_commit(self, callback=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Tx.Commit(), callback, [spec.Tx.CommitOk])
|
'Rollback a transaction.
:param callable callback: The callback for delivery confirmations'
| def tx_rollback(self, callback=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Tx.Rollback(), callback, [spec.Tx.RollbackOk])
|
'Select standard transaction mode. This method sets the channel to use
standard transactions. The client must use this method at least once on
a channel before using the Commit or Rollback methods.
:param callable callback: The callback for delivery confirmations'
| def tx_select(self, callback=None):
| self._validate_channel_and_callback(callback)
return self._rpc(spec.Tx.Select(), callback, [spec.Tx.SelectOk])
|
'Callbacks that add the required behavior for a channel when
connecting and connected to a server.'
| def _add_callbacks(self):
| self.callbacks.add(self.channel_number, spec.Basic.GetEmpty, self._on_getempty, False)
self.callbacks.add(self.channel_number, spec.Basic.Cancel, self._on_cancel, False)
self.callbacks.add(self.channel_number, spec.Channel.Flow, self._on_flow, False)
self.callbacks.add(self.channel_number, spec.Channel.... |
'For internal use only (e.g., Connection needs to remove closed
channels from its channel container). Pass a callback function that will
be called when the channel is being cleaned up after all channel-close
callbacks callbacks.
:param callable callback: The callback to call, having the
signature: callback(channel)'
| def _add_on_cleanup_callback(self, callback):
| self.callbacks.add(self.channel_number, self._ON_CHANNEL_CLEANUP_CB_KEY, callback, one_shot=True, only_caller=self)
|
'Remove all consumers and any callbacks for the channel.'
| def _cleanup(self):
| self.callbacks.process(self.channel_number, self._ON_CHANNEL_CLEANUP_CB_KEY, self, self)
self._consumers = dict()
self.callbacks.cleanup(str(self.channel_number))
self._cookie = None
|
'Remove any references to the consumer tag in internal structures
for consumer state.
:param str consumer_tag: The consumer tag to cleanup'
| def _cleanup_consumer_ref(self, consumer_tag):
| self._consumers_with_noack.discard(consumer_tag)
self._consumers.pop(consumer_tag, None)
self._cancelled.discard(consumer_tag)
|
'Used by the wrapper implementation (e.g., `BlockingChannel`) to
retrieve the cookie that it set via `_set_cookie`
:returns: opaque cookie value that was set via `_set_cookie`'
| def _get_cookie(self):
| return self._cookie
|
'This is invoked by the connection when frames that are not registered
with the CallbackManager have been found. This should only be the case
when the frames are related to content delivery.
The _content_assembler will be invoked which will return the fully
formed message in three parts when all of the body frames have... | def _handle_content_frame(self, frame_value):
| try:
response = self._content_assembler.process(frame_value)
except exceptions.UnexpectedFrameError:
self._on_unexpected_frame(frame_value)
return
if response:
if isinstance(response[0].method, spec.Basic.Deliver):
self._on_deliver(*response)
elif isinstan... |
'When the broker cancels a consumer, delete it from our internal
dictionary.
:param pika.frame.Method method_frame: The method frame received'
| def _on_cancel(self, method_frame):
| if (method_frame.method.consumer_tag in self._cancelled):
return
self._cleanup_consumer_ref(method_frame.method.consumer_tag)
|
'Called in response to a frame from the Broker when the
client sends Basic.Cancel
:param pika.frame.Method method_frame: The method frame received'
| def _on_cancelok(self, method_frame):
| self._cleanup_consumer_ref(method_frame.method.consumer_tag)
|
'Handle the case where our channel has been closed for us
:param pika.frame.Method method_frame: Method frame with Channel.Close
method'
| def _on_close(self, method_frame):
| LOGGER.warning('Received remote Channel.Close (%s): %r on %s', method_frame.method.reply_code, method_frame.method.reply_text, self)
self._send_method(spec.Channel.CloseOk())
if self.is_closing:
self._closing_code_and_text = (method_frame.method.reply_code, method_frame.method.repl... |
'Handle meta-close request from Connection\'s cleanup logic after
sudden connection loss. We use this opportunity to transition to
CLOSED state, clean up the channel, and dispatch the on-channel-closed
callbacks.
:param int reply_code: The reply code to pass to on-close callback
:param str reply_text: The reply text to... | def _on_close_meta(self, reply_code, reply_text):
| LOGGER.debug('Handling meta-close on %s', self)
if (not self.is_closed):
self._closing_code_and_text = (reply_code, reply_text)
self._set_state(self.CLOSED)
try:
self.callbacks.process(self.channel_number, '_on_channel_close', self, self, reply_code, reply_text)
... |
'Invoked when RabbitMQ replies to a Channel.Close method
:param pika.frame.Method method_frame: Method frame with Channel.CloseOk
method'
| def _on_closeok(self, method_frame):
| LOGGER.info('Received %s on %s', method_frame.method, self)
self._set_state(self.CLOSED)
try:
self.callbacks.process(self.channel_number, '_on_channel_close', self, self, self._closing_code_and_text[0], self._closing_code_and_text[1])
finally:
self._cleanup()
|
'Cope with reentrancy. If a particular consumer is still active when
another delivery appears for it, queue the deliveries up until it
finally exits.
:param pika.frame.Method method_frame: The method frame received
:param pika.frame.Header header_frame: The header frame received
:param body: The body received
:type bod... | def _on_deliver(self, method_frame, header_frame, body):
| consumer_tag = method_frame.method.consumer_tag
if (consumer_tag in self._cancelled):
if (self.is_open and (consumer_tag not in self._consumers_with_noack)):
self.basic_reject(method_frame.method.delivery_tag)
return
if (consumer_tag not in self._consumers):
LOGGER.error(... |
'Generic events that returned ok that may have internal callbacks.
We keep a list of what we\'ve yet to implement so that we don\'t silently
drain events that we don\'t support.
:param pika.frame.Method method_frame: The method frame received'
| def _on_eventok(self, method_frame):
| LOGGER.debug('Discarding frame %r', method_frame)
|
'Called if the server sends a Channel.Flow frame.
:param pika.frame.Method method_frame_unused: The Channel.Flow frame'
| def _on_flow(self, _method_frame_unused):
| if (self._has_on_flow_callback is False):
LOGGER.warning('Channel.Flow received from server')
|
'Called in response to us asking the server to toggle on Channel.Flow
:param pika.frame.Method method_frame: The method frame received'
| def _on_flowok(self, method_frame):
| self.flow_active = method_frame.method.active
if self._on_flowok_callback:
self._on_flowok_callback(method_frame.method.active)
self._on_flowok_callback = None
else:
LOGGER.warning('Channel.FlowOk received with no active callbacks')
|
'When we receive an empty reply do nothing but log it
:param pika.frame.Method method_frame: The method frame received'
| def _on_getempty(self, method_frame):
| LOGGER.debug('Received Basic.GetEmpty: %r', method_frame)
if (self._on_getok_callback is not None):
self._on_getok_callback = None
|
'Called in reply to a Basic.Get when there is a message.
:param pika.frame.Method method_frame: The method frame received
:param pika.frame.Header header_frame: The header frame received
:param body: The body received
:type body: str or unicode'
| def _on_getok(self, method_frame, header_frame, body):
| if (self._on_getok_callback is not None):
callback = self._on_getok_callback
self._on_getok_callback = None
callback(self, method_frame.method, header_frame.properties, body)
else:
LOGGER.error('Basic.GetOk received with no active callback')
|
'Called by our callback handler when we receive a Channel.OpenOk and
subsequently calls our _on_openok_callback which was passed into the
Channel constructor. The reason we do this is because we want to make
sure that the on_open_callback parameter passed into the Channel
constructor is not the first callback we make.
... | def _on_openok(self, method_frame):
| if self.is_closing:
LOGGER.debug('Suppressing while in closing state: %s', method_frame)
else:
self._set_state(self.OPEN)
if (self._on_openok_callback is not None):
self._on_openok_callback(self)
|
'Called if the server sends a Basic.Return frame.
:param pika.frame.Method method_frame: The Basic.Return frame
:param pika.frame.Header header_frame: The content header frame
:param body: The message body
:type body: str or unicode'
| def _on_return(self, method_frame, header_frame, body):
| if (not self.callbacks.process(self.channel_number, '_on_return', self, self, method_frame.method, header_frame.properties, body)):
LOGGER.warning('Basic.Return received from server (%r, %r)', method_frame.method, header_frame.properties)
|
'Called when the broker sends a Confirm.SelectOk frame
:param pika.frame.Method method_frame: The method frame received'
| def _on_selectok(self, method_frame):
| LOGGER.debug('Confirm.SelectOk Received: %r', method_frame)
|
'This is called when a synchronous command is completed. It will undo
the blocking state and send all the frames that stacked up while we
were in the blocking state.
:param pika.frame.Method method_frame_unused: The method frame received'
| def _on_synchronous_complete(self, _method_frame_unused):
| LOGGER.debug('%i blocked frames', len(self._blocked))
self._blocking = None
while (self._blocked and (self._blocking is None)):
self._rpc(*self._blocked.popleft())
|
'Make a syncronous channel RPC call for a synchronous method frame. If
the channel is already in the blocking state, then enqueue the request,
but don\'t send it at this time; it will be eventually sent by
`_on_synchronous_complete` after the prior blocking request receives a
resposne. If the channel is not in the bloc... | def _rpc(self, method, callback=None, acceptable_replies=None):
| assert method.synchronous, ('Only synchronous-capable methods may be used with _rpc: %r' % (method,))
if (not isinstance(acceptable_replies, (type(None), list))):
raise TypeError('acceptable_replies should be list or None')
if (callback is not None):
if... |
'Shortcut wrapper to send a method through our connection, passing in
the channel number
:param pika.amqp_object.Method method: The method to send
:param tuple content: If set, is a content frame, is tuple of
properties and body.'
| def _send_method(self, method, content=None):
| self.connection._send_method(self.channel_number, method, content)
|
'Used by wrapper layer (e.g., `BlockingConnection`) to link the
channel implementation back to the proxy. See `_get_cookie`.
:param cookie: an opaque value; typically a proxy channel implementation
instance (e.g., `BlockingChannel` instance)'
| def _set_cookie(self, cookie):
| self._cookie = cookie
|
'Set the channel connection state to the specified state value.
:param int connection_state: The connection_state value'
| def _set_state(self, connection_state):
| self._state = connection_state
|
'Invoked when a frame is received that is not setup to be processed.
:param pika.frame.Frame frame_value: The frame received'
| def _on_unexpected_frame(self, frame_value):
| LOGGER.error('Unexpected frame: %r', frame_value)
|
'Verify that channel is open and callback is callable if not None
:raises ChannelClosed: if channel is closed
:raises ValueError: if callback is not None and is not callable'
| def _validate_channel_and_callback(self, callback):
| if (not self.is_open):
raise exceptions.ChannelClosed()
if ((callback is not None) and (not is_callable(callback))):
raise ValueError('callback must be a function or method')
|
'Create a new instance of the conent frame assembler.'
| def __init__(self):
| self._method_frame = None
self._header_frame = None
self._seen_so_far = 0
self._body_fragments = list()
|
'Invoked by the Channel object when passed frames that are not
setup in the rpc process and that don\'t have explicit reply types
defined. This includes Basic.Publish, Basic.GetOk and Basic.Return
:param Method|Header|Body frame_value: The frame to process'
| def process(self, frame_value):
| if (isinstance(frame_value, frame.Method) and spec.has_content(frame_value.method.INDEX)):
self._method_frame = frame_value
elif isinstance(frame_value, frame.Header):
self._header_frame = frame_value
if (frame_value.body_size == 0):
return self._finish()
elif isinstance(... |
'Invoked when all of the message has been received
:rtype: tuple(pika.frame.Method, pika.frame.Header, str)'
| def _finish(self):
| content = (self._method_frame, self._header_frame, ''.join(self._body_fragments))
self._reset()
return content
|
'Receive body frames and append them to the stack. When the body size
matches, call the finish method.
:param Body body_frame: The body frame
:raises: pika.exceptions.BodyTooLongError
:rtype: tuple(pika.frame.Method, pika.frame.Header, str)|None'
| def _handle_body_frame(self, body_frame):
| self._seen_so_far += len(body_frame.fragment)
self._body_fragments.append(body_frame.fragment)
if (self._seen_so_far == self._header_frame.body_size):
return self._finish()
elif (self._seen_so_far > self._header_frame.body_size):
raise exceptions.BodyTooLongError(self._seen_so_far, self.... |
'Reset the values for processing frames'
| def _reset(self):
| self._method_frame = None
self._header_frame = None
self._seen_so_far = 0
self._body_fragments = list()
|
'Represent the info about the instance.
:rtype: str'
| def __repr__(self):
| return ('<%s host=%s port=%s virtual_host=%s ssl=%s>' % (self.__class__.__name__, self.host, self.port, self.virtual_host, self.ssl))
|
':returns: boolean indicatating whether backpressure detection is
enabled. Defaults to `DEFAULT_BACKPRESSURE_DETECTION`.'
| @property
def backpressure_detection(self):
| return self._backpressure_detection
|
':param bool value: boolean indicatating whether to enable backpressure
detection'
| @backpressure_detection.setter
def backpressure_detection(self, value):
| if (not isinstance(value, bool)):
raise TypeError(('backpressure_detection must be a bool, but got %r' % (value,)))
self._backpressure_detection = value
|
':returns: None or float blocked connection timeout. Defaults to
`DEFAULT_BLOCKED_CONNECTION_TIMEOUT`.'
| @property
def blocked_connection_timeout(self):
| return self._blocked_connection_timeout
|
':param value: If not None, blocked_connection_timeout is the timeout, in
seconds, for the connection to remain blocked; if the timeout
expires, the connection will be torn down, triggering the
connection\'s on_close_callback'
| @blocked_connection_timeout.setter
def blocked_connection_timeout(self, value):
| if (value is not None):
if (not isinstance(value, numbers.Real)):
raise TypeError(('blocked_connection_timeout must be a Real number, but got %r' % (value,)))
if (value < 0):
raise ValueError(('blocked_connection_timeout must be >= 0, bu... |
':returns: max preferred number of channels. Defaults to
`DEFAULT_CHANNEL_MAX`.
:rtype: int'
| @property
def channel_max(self):
| return self._channel_max
|
':param int value: max preferred number of channels, between 1 and
`channel.MAX_CHANNELS`, inclusive'
| @channel_max.setter
def channel_max(self, value):
| if (not isinstance(value, numbers.Integral)):
raise TypeError(('channel_max must be an int, but got %r' % (value,)))
if ((value < 1) or (value > pika.channel.MAX_CHANNELS)):
raise ValueError(('channel_max must be <= %i and > 0, but got %r' % (pi... |
':returns: None or dict of client properties used to override the fields
in the default client poperties reported to RabbitMQ via
`Connection.StartOk` method. Defaults to
`DEFAULT_CLIENT_PROPERTIES`.'
| @property
def client_properties(self):
| return self._client_properties
|
':param value: None or dict of client properties used to override the
fields in the default client poperties reported to RabbitMQ via
`Connection.StartOk` method.'
| @client_properties.setter
def client_properties(self, value):
| if (not isinstance(value, (dict, type(None)))):
raise TypeError(('client_properties must be dict or None, but got %r' % (value,)))
self._client_properties = copy.deepcopy(value)
|
':returns: number of socket connection attempts. Defaults to
`DEFAULT_CONNECTION_ATTEMPTS`.'
| @property
def connection_attempts(self):
| return self._connection_attempts
|
':param int value: number of socket connection attempts of at least 1'
| @connection_attempts.setter
def connection_attempts(self, value):
| if (not isinstance(value, numbers.Integral)):
raise TypeError('connection_attempts must be an int')
if (value < 1):
raise ValueError(('connection_attempts must be > 0, but got %r' % (value,)))
self._connection_attempts = value
|
':rtype: one of the classes from `pika.credentials.VALID_TYPES`. Defaults
to `DEFAULT_CREDENTIALS`.'
| @property
def credentials(self):
| return self._credentials
|
':param value: authentication credential object of one of the classes
from `pika.credentials.VALID_TYPES`'
| @credentials.setter
def credentials(self, value):
| if (not isinstance(value, tuple(pika_credentials.VALID_TYPES))):
raise TypeError(('Credentials must be an object of type: %r, but got %r' % (pika_credentials.VALID_TYPES, value)))
self._credentials = copy.deepcopy(value)
|
':returns: desired maximum AMQP frame size to use. Defaults to
`DEFAULT_FRAME_MAX`.'
| @property
def frame_max(self):
| return self._frame_max
|
':param int value: desired maximum AMQP frame size to use between
`spec.FRAME_MIN_SIZE` and `spec.FRAME_MAX_SIZE`, inclusive'
| @frame_max.setter
def frame_max(self, value):
| if (not isinstance(value, numbers.Integral)):
raise TypeError(('frame_max must be an int, but got %r' % (value,)))
if (value < spec.FRAME_MIN_SIZE):
raise ValueError('Min AMQP 0.9.1 Frame Size is %i, but got %r', (spec.FRAME_MIN_SIZE, value))
e... |
':returns: desired connection heartbeat timeout for negotiation or
None to accept broker\'s value. 0 turns heartbeat off. Defaults to
`DEFAULT_HEARTBEAT_TIMEOUT`.
:rtype: integer, float, or None'
| @property
def heartbeat(self):
| return self._heartbeat
|
':param value: desired connection heartbeat timeout for negotiation or
None to accept broker\'s value. 0 turns heartbeat off.'
| @heartbeat.setter
def heartbeat(self, value):
| if (value is not None):
if (not isinstance(value, numbers.Integral)):
raise TypeError(('heartbeat must be an int, but got %r' % (value,)))
if (value < 0):
raise ValueError(('heartbeat must >= 0, but got %r' % (value,)))
self._heartbe... |
':returns: hostname or ip address of broker. Defaults to `DEFAULT_HOST`.
:rtype: str'
| @property
def host(self):
| return self._host
|
':param str value: hostname or ip address of broker'
| @host.setter
def host(self, value):
| if (not isinstance(value, basestring)):
raise TypeError(('host must be a str or unicode str, but got %r' % (value,)))
self._host = value
|
':returns: locale value to pass to broker; e.g., \'en_US\'. Defaults to
`DEFAULT_LOCALE`.
:rtype: str'
| @property
def locale(self):
| return self._locale
|
':param str value: locale value to pass to broker; e.g., "en_US"'
| @locale.setter
def locale(self, value):
| if (not isinstance(value, basestring)):
raise TypeError(('locale must be a str, but got %r' % (value,)))
self._locale = value
|
':returns: port number of broker\'s listening socket. Defaults to
`DEFAULT_PORT`.
:rtype: int'
| @property
def port(self):
| return self._port
|
':param int value: port number of broker\'s listening socket'
| @port.setter
def port(self, value):
| if (not isinstance(value, numbers.Integral)):
raise TypeError(('port must be an int, but got %r' % (value,)))
self._port = value
|
':returns: interval between socket connection attempts; see also
`connection_attempts`. Defaults to `DEFAULT_RETRY_DELAY`.
:rtype: float'
| @property
def retry_delay(self):
| return self._retry_delay
|
':param float value: interval between socket connection attempts; see
also `connection_attempts`.'
| @retry_delay.setter
def retry_delay(self, value):
| if (not isinstance(value, numbers.Real)):
raise TypeError(('retry_delay must be a float or int, but got %r' % (value,)))
self._retry_delay = value
|
':returns: socket timeout value. Defaults to `DEFAULT_SOCKET_TIMEOUT`.
:rtype: float'
| @property
def socket_timeout(self):
| return self._socket_timeout
|
':param float value: socket timeout value; NOTE: this is mostly unused
now, owing to switchover to to non-blocking socket setting after
initial socket conection establishment.'
| @socket_timeout.setter
def socket_timeout(self, value):
| if (value is not None):
if (not isinstance(value, numbers.Real)):
raise TypeError(('socket_timeout must be a float or int, but got %r' % (value,)))
if (not (value > 0)):
raise ValueError(('socket_timeout must be > 0, but got %r'... |
':returns: boolean indicating whether to connect via SSL. Defaults to
`DEFAULT_SSL`.'
| @property
def ssl(self):
| return self._ssl
|
':param bool value: boolean indicating whether to connect via SSL'
| @ssl.setter
def ssl(self, value):
| if (not isinstance(value, bool)):
raise TypeError(('ssl must be a bool, but got %r' % (value,)))
self._ssl = value
|
':returns: None or a dict of options to pass to `ssl.wrap_socket`.
Defaults to `DEFAULT_SSL_OPTIONS`.'
| @property
def ssl_options(self):
| return self._ssl_options
|
':param value: None or a dict of options to pass to `ssl.wrap_socket`.'
| @ssl_options.setter
def ssl_options(self, value):
| if (not isinstance(value, (dict, type(None)))):
raise TypeError(('ssl_options must be a dict or None, but got %r' % (value,)))
self._ssl_options = copy.deepcopy(value)
|
':returns: rabbitmq virtual host name. Defaults to
`DEFAULT_VIRTUAL_HOST`.'
| @property
def virtual_host(self):
| return self._virtual_host
|
':param str value: rabbitmq virtual host name'
| @virtual_host.setter
def virtual_host(self, value):
| if (not isinstance(value, basestring)):
raise TypeError(('virtual_host must be a str, but got %r' % (value,)))
self._virtual_host = value
|
'Create a new ConnectionParameters instance. See `Parameters` for
default values.
:param str host: Hostname or IP Address to connect to
:param int port: TCP port to connect to
:param str virtual_host: RabbitMQ virtual host to use
:param pika.credentials.Credentials credentials: auth credentials
:param int channel_max: ... | def __init__(self, host=_DEFAULT, port=_DEFAULT, virtual_host=_DEFAULT, credentials=_DEFAULT, channel_max=_DEFAULT, frame_max=_DEFAULT, heartbeat=_DEFAULT, ssl=_DEFAULT, ssl_options=_DEFAULT, connection_attempts=_DEFAULT, retry_delay=_DEFAULT, socket_timeout=_DEFAULT, locale=_DEFAULT, backpressure_detection=_DEFAULT, b... | super(ConnectionParameters, self).__init__()
if (backpressure_detection is not self._DEFAULT):
self.backpressure_detection = backpressure_detection
if (blocked_connection_timeout is not self._DEFAULT):
self.blocked_connection_timeout = blocked_connection_timeout
if (channel_max is not se... |
'Create a new URLParameters instance.
:param str url: The URL value'
| def __init__(self, url):
| super(URLParameters, self).__init__()
self._all_url_query_values = None
if (url[0:4].lower() == 'amqp'):
url = ('http' + url[4:])
parts = urlparse.urlparse(url)
if (parts.scheme == 'https'):
self.ssl = True
elif (parts.scheme == 'http'):
self.ssl = False
elif parts.sc... |
'Deserialize and apply the corresponding query string arg'
| def _set_url_backpressure_detection(self, value):
| try:
backpressure_detection = {'t': True, 'f': False}[value]
except KeyError:
raise ValueError(('Invalid backpressure_detection value: %r' % (value,)))
self.backpressure_detection = backpressure_detection
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_blocked_connection_timeout(self, value):
| try:
blocked_connection_timeout = float(value)
except ValueError as exc:
raise ValueError(('Invalid blocked_connection_timeout value %r: %r' % (value, exc)))
self.blocked_connection_timeout = blocked_connection_timeout
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_channel_max(self, value):
| try:
channel_max = int(value)
except ValueError as exc:
raise ValueError(('Invalid channel_max value %r: %r' % (value, exc)))
self.channel_max = channel_max
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_client_properties(self, value):
| self.client_properties = ast.literal_eval(value)
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_connection_attempts(self, value):
| try:
connection_attempts = int(value)
except ValueError as exc:
raise ValueError(('Invalid connection_attempts value %r: %r' % (value, exc)))
self.connection_attempts = connection_attempts
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_frame_max(self, value):
| try:
frame_max = int(value)
except ValueError as exc:
raise ValueError(('Invalid frame_max value %r: %r' % (value, exc)))
self.frame_max = frame_max
|
'Deserialize and apply the corresponding query string arg'
| def _set_url_heartbeat(self, value):
| if ('heartbeat_interval' in self._all_url_query_values):
raise ValueError('Deprecated URL parameter heartbeat_interval must not be specified together with heartbeat')
try:
heartbeat_timeout = int(value)
except ValueError as exc:
raise ValueError(('Invali... |
'Deserialize and apply the corresponding query string arg'
| def _set_url_heartbeat_interval(self, value):
| warnings.warn('heartbeat_interval is deprecated, use heartbeat', DeprecationWarning, stacklevel=2)
if ('heartbeat' in self._all_url_query_values):
raise ValueError('Deprecated URL parameter heartbeat_interval must not be specified together with heartbeat')
t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.