Create durable subscriber via Java API (deprecated methods)


we use Universal Messaging v 9.12 and are about to create a small java application that would read events from a UM realm.

The java application would register a durable subscriber for a channel.

I’ve looked through the API and through the “Universal Messaging Developer Guide” and saw the following methods for doing this:

// First (from the Universal Messaging Developer Guide)
channel.addSubscriber(nEventListener, nNamedObject);

// Second (suggested by the Java IDE)
channel.addSubscriber(nEventListener, nDurable);

I understand how to use the first method: first create a named object using nChannel.createNamedObject() (or nChannel.createSharedNamedObject()) and then call the addSubscriber method with the parameter of type nNamedObject. But it is marked as deprecated. So I’d like to use the second variant.

Could anybody tell me how to create a nDurable instance? I could not find any method in nChannel that would return this type.

Thank you!


Here is a sample snippet that can help you in order to create nDurable object.
//create &init session
nSessionAttributes nsa = new nSessionAttributes(server.getDefaultAdapter());
nSession session = nSessionFactory.create(nsa);
//get the Channel and Durable Manager
nChannelAttributes nca = new nChannelAttributes(CHANNEL_NAME);
nChannel channel = session.findChannel(nca);
nDurableManager durableManager = channel.getDurableManager();
//create nDurbale object
nDurableAttributes da = nDurableAttributes.create(nDurableAttributes.nDurableType.SharedQueued, name);
nDurable durable = durableManager.add(da);
//use this object with Second API (suggested by the Java IDE)
channel.addSubscriber(nEventListener, durable );

let’s know if you need further help.


1 Like

More recent versions of the online docs contain articles on the usage of both the Java and C# flavours of the nDurable API - just search for nDurable in the latest doc set (unfortunately I’m not allowed to post links)



Well, Here is link that Stefan has mentioned in the last comment. It is for 10.7 version.
Using Durable Subscriptions (

or if you have PDF for latest versions you can find the topic “using durable subscription”.


1 Like

Thank you all for the quick help! It works like a charm.


This was the missing link. Somehow I oversaw this method.

Just one more question: Should I check whether a durable with the desired name already exists before adding it? Or is it safe just to add it (possibly “overwriting”)? Or will it be an No-Op if the durable with the name already exists?

well, in that case API will throw nNameAlreadyBoundException If the name is already in use. :slight_smile:

I tried and got no exception even when using an existing name. Hence the question.

I wonder whether using an existing name would somehow reset the LastEID etc stored on the server.