I'm trying to get a Qpid Proton Python client to subscribe to an ActiveMQ broker over AMQP v1.0 as a durable consumer.
I can create a durable subscription but don't quite understand how to pick up the same subscription the next time my script runs.
After each run, the ActiveMQ admin console shows that a durable subscription has been created, and it is named according to my script's input, but the next run just creates another rather than connects to the one previously created.
I think I might be missing the creation of a "ClientID" (as ActiveMQ calls it) but can't see (in the Qpid Proton documentation) how to set it.
Here's my code:-
def on_start(self, event):
if self.subscription_name:
logging.debug("Naming durable subscription " + self.subscription_name)
durable = DurableSubscription()
else:
logging.debug("Subscription will not be durable")
durable = None
messaging_connection = event.container.connect(self.url)
logging.info(messaging_connection.clientID)
event.container.create_receiver(
messaging_connection,
self.resource,
name=self.subscription_name,
options=durable
)
logging.debug("Connected to " + self.url + "/" + self.resource)