Package proton :: Module reactor :: Class Container
[frames] | no frames]

Class Container

source code


A representation of the AMQP concept of a 'container', which lossely speaking is something that establishes links to or from another container, over which messages are transfered. This is an extension to the Reactor class that adds convenience methods for creating connections and sender- or receiver- links.

Nested Classes

Inherited from Reactor: ErrorDelegate

Instance Methods
 
__init__(self, *handlers, **kwargs) source code
 
connect(self, url=None, urls=None, address=None, handler=None, reconnect=None, heartbeat=None, ssl_domain=None, **kwargs)
Initiates the establishment of an AMQP connection.
source code
 
create_sender(self, context, target=None, source=None, name=None, handler=None, tags=None, options=None)
Initiates the establishment of a link over which messages can be sent.
source code
 
create_receiver(self, context, source=None, target=None, name=None, dynamic=False, handler=None, options=None)
Initiates the establishment of a link over which messages can be received (aka a subscription).
source code
 
declare_transaction(self, context, handler=None, settle_before_discharge=False) source code
 
listen(self, url, ssl_domain=None)
Initiates a server socket, accepting incoming AMQP connections on the interface and port specified.
source code
 
do_work(self, timeout=None) source code

Inherited from Reactor: acceptor, connection, connection_to_host, get_connection_address, mark, on_error, on_error_delegate, process, push_event, quiesced, run, schedule, selectable, set_connection_host, start, stop, update, wakeup, yield_

Inherited from wrapper.Wrapper: __del__, __delattr__, __eq__, __getattr__, __hash__, __ne__, __repr__, __setattr__

Static Methods

Inherited from Reactor: wrap

Class Variables

Inherited from Reactor: global_handler, handler, timeout

Method Details

__init__(self, *handlers, **kwargs)
(Constructor)

source code 
Overrides: wrapper.Wrapper.__init__

connect(self, url=None, urls=None, address=None, handler=None, reconnect=None, heartbeat=None, ssl_domain=None, **kwargs)

source code 

Initiates the establishment of an AMQP connection. Returns an instance of proton.Connection.

Parameters:
  • url - URL string of process to connect to
  • urls - list of URL strings of process to try to connect to

    Only one of url or urls should be specified.

  • reconnect - A value of False will prevent the library form automatically trying to reconnect if the underlying socket is disconnected before the connection has been closed.
  • heartbeat - A value in milliseconds indicating the desired frequency of heartbeats used to test the underlying socket is alive.
  • ssl_domain - SSL configuration in the form of an instance of proton.SSLdomain.
  • handler - a connection scoped handler that will be called to process any events in the scope of this connection or its child links
  • kwargs - sasl_enabled, which determines whether a sasl layer is used for the connection; allowed_mechs an optional list of SASL mechanisms to allow if sasl is enabled; allow_insecure_mechs a flag indicating whether insecure mechanisms, such as PLAIN over a non-encrypted socket, are allowed; 'virtual_host' the hostname to set in the Open performative used by peer to determine the correct back-end service for the client. If 'virtual_host' is not supplied the host field from the URL is used instead."

create_sender(self, context, target=None, source=None, name=None, handler=None, tags=None, options=None)

source code 

Initiates the establishment of a link over which messages can be sent. Returns an instance of proton.Sender.

There are two patterns of use. (1) A connection can be passed as the first argument, in which case the link is established on that connection. In this case the target address can be specified as the second argument (or as a keyword argument). The source address can also be specified if desired. (2) Alternatively a URL can be passed as the first argument. In this case a new connection will be establised on which the link will be attached. If a path is specified and the target is not, then the path of the URL is used as the target address.

The name of the link may be specified if desired, otherwise a unique name will be generated.

Various LinkOptions can be specified to further control the attachment.

create_receiver(self, context, source=None, target=None, name=None, dynamic=False, handler=None, options=None)

source code 

Initiates the establishment of a link over which messages can be received (aka a subscription). Returns an instance of proton.Receiver.

There are two patterns of use. (1) A connection can be passed as the first argument, in which case the link is established on that connection. In this case the source address can be specified as the second argument (or as a keyword argument). The target address can also be specified if desired. (2) Alternatively a URL can be passed as the first argument. In this case a new connection will be establised on which the link will be attached. If a path is specified and the source is not, then the path of the URL is used as the target address.

The name of the link may be specified if desired, otherwise a unique name will be generated.

Various LinkOptions can be specified to further control the attachment.