Hi Gordon,
Many thanks - I thought it would be simple.  Did I miss where this is 
documented?
With the change you've suggested in place, I notice that the subscription is 
only durable when I ctrl-C my script.  If it finishes normally then the 
subscription seems to be deleted.  Presumably this is a feature of Proton.  
What do I need to do so that my script can exit elegantly but still leave the 
subscription in place?  Do I need to do something in the "on_disconnected" 
method?
J.

      From: Gordon Sim <[email protected]>
 To: [email protected] 
 Sent: Wednesday, 15 February 2017, 10:47
 Subject: Re: Connecting to durable consumer - Qpid Proton Python.
   
On 15/02/17 09:05, Jeremy Gooch wrote:
> Hi,
> I'm trying to get a Qpid Proton Python v3.4 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.  The 
> subscription works correctly, in that it receives messages even after my 
> script has ended.  When I next execute the script, however, it just creates a 
> new subscription rather than connect to the one previously created.I think I 
> might need to set a "ClientID" (as ActiveMQ calls it) against the 
> subscription but I don't understand the syntax to use.

Set the container_id on the container before the connect, e.g.

  event.container.container_id = "my-client-id"

> Here's the bit of my code that creates the connection:-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)
> Thanks,Jeremy.
>
> Jeremy Gooch http://goochgooch.co.uk
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



   

Reply via email to