Creating a durable topic subscription is similar to creating a nondurable subscription, but you must additionally provide a name that identifies the durable subscription as shown below.
Code Block language java
// Create a durable subscriber, supplying a uniquely-identifying name TopicSubscriber sub = session.createDurableSubscriber( topic, "mySub1_0001" );
Shown below is the connection URL used for subscribing to WSO2 MB during an AMQP session. See the topic on setting the connection URL for more information.
connectionfactory.Connectionfactory = amqp://admin:[email protected]/carbon?brokerlist='tcp://192.168.10.5:5682'
- Reusing a durable topic subscription: To reuse a durable subscription that was created previously, the subscriber client must create a durable topic subscriber using a session with the same client identifier as that associated with the durable subscription.