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:

concurrent.futures.Future

Raises:
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 returned concurrent.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:

concurrent.futures.Future

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:

Connectable

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:

Connectable

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, the MessagingService has been successfully connected.

Raises:
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, the Messaging 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:

bool

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:

Connectable

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:

Connectable