solace.messaging.connections package
solace.messaging.connections.async_connectable module
This module provides abstract classes that define the interface for asynchronous connection on a
solace.messaging.messaging_service.MessagingService
Asynchronous connections actions return a concurrent.futures.Future object rather than wait for the connection to complete.
- class solace.messaging.connections.async_connectable.AsyncConnectable
Bases:
ABC
An abstract class that provides an interface for asynchronous connections.
- abstract connect_async() Future
Connects asynchronously with a PubSub+ event broker. This method initiates the connection process on the
solace.messaging.messaging_service.MessagingService
. The connection proceeds asynchronously, with the success or failure status available in the returned concurrent.futures.Future object.This method initiates the connect process on the
solace.messaging.messaging_service.MessagingService
. The connection proceeds asynchronously, with the success or failure status available in the returned concurrent.futures.Future object.- Returns:
An object that the application may use to determine when the connection attempt has completed.
- Return type:
- Raises:
PubSubPlusClientError – If the messaging service cannot be connected.
IllegalStateError – if an attempt to connect to a messaging service that’s been disconnected.
- abstract disconnect_async() Future
Initiates the disconnection process on a
solace.messaging.messaging_service.MessagingService
instance. The disconnection process proceeds asynchronously with the completion notice available in the returnedconcurrent.futures.Future
Once disconnect is complete, the
MessagingService
can not be connected again.- Returns:
An object that your application can use to determine when the disconnection process has completed.
- Return type:
- Raises:
PubSubPlusClientError – If the messaging service cannot be disconnected.
solace.messaging.connections.connectable module
This module provides abstract classes that define the interface for synchronous connection on a
solace.messaging.messaging_service.MessagingService
instance.
Synchronous connections do not return until the connection operation is complete.
- class solace.messaging.connections.connectable.Connectable
Bases:
ABC
An abstract class that provides a interface for synchronous connections.
- abstract add_reconnection_attempt_listener(listener: ReconnectionAttemptListener) Connectable
Registers a
solace.messaging.messaging_service.ReconnectionAttemptListener
to receive notification of reconnection attempts. Reconnection attempt notifications are generated when an established connection fails and the API begins the reconnection process.- Parameters:
listener (ReconnectionListener) – The listener to register with the reconnection attempt.
- Returns:
An object representing a synchronous connection.
- Return type:
- abstract add_reconnection_listener(listener: ReconnectionListener) Connectable
Registers a
solace.messaging.messaging_service.ReconnectionListener
to receive notification of successful reconnection. Reconnection notifications are generated when an established connection fails and is subsequently successfully reconnects.- Parameters:
listener (ReconnectionListener) – The listener to register.
- Returns:
An object representing a synchronous connection.
- Return type:
- abstract connect() Connectable
Initiates the synchronous connection process with a PubSub+ event broker on a
solace.messaging.messaging_service.MessagingService
instance. In order to operate normally this method needs to be called on a service instance. After the method returns, theMessagingService
has been successfully connected.- Raises:
PubSubPlusClientError – If the
MessagingService
cannot be connected.IllegalStateError – When another connect/disconnect operation is ongoing.
- abstract disconnect()
Initiates the disconnect (synchronous) process on the
solace.messaging.messaging_service.MessagingService
. The method does not return until the disconnect process completes. After the disconnect process completes, theMessaging Service
can not be connected again.
- abstract property is_connected: bool
Determines whether a service is currently connected and indicate the current state of the
solace.messaging.messaging_service.MessagingService
.- Returns:
True if service is connected to a PubSub+ event broker, otherwise False.
- Return type:
- Raises:
PubSubPlusClientError – If the state of the service cannot be determined.
- abstract remove_reconnection_attempt_listener(listener: ReconnectionAttemptListener) Connectable
Remove a
solace.messaging.messaging_service.ReconnectionAttemptListener
- Parameters:
listener (ReconnectionListener) – The listener to deregister.
- Returns:
An object representing a synchronous connection.
- Return type:
- abstract remove_reconnection_listener(listener: ReconnectionListener) Connectable
Removes a
solace.messaging.messaging_service.ReconnectionListener
.- Parameters:
listener (ReconnectionListener) – A reconnection listener to remove.
- Returns:
An object representing a synchronous connection.
- Return type: