User1 is a durable subscriber for Topics 2 & 3
User2 is a durable subscriber for Topics 1 & 3
User3 is a durable subscriber for Topics 1 & 2

A MessageListener is ON for each subscriber.

To register a subscriber (here : User1), I use :

Receiver receiver1 = new Receiver(user1);

Each user's got its own ClientID (its name).

Then, to subscribe this user to topics (here : topics 2 & 3), I use :

receiver1.receiveMessage(topic2);
receiver1.receiveMessage(topic3);

Each subscription's got its own DurableID.
DurableID is generated like this : ClientID+Topic_Name

Sometimes, a User may want to unsubscribe from one particular topic, but not all of them.

If User1 want to unsubscribe from Topic3, I will do something like this :

session.unsubscribe(DurableID);

with DurableID = User1Topic3

Where I've got a problem is that when I want to unsubscribe, I've got an error message :

"javax.jms.JMSException: Durable consumer is in use"

If I try a "consumer.close()" before, it doesn't work more.

I really don't see how to workaround this problem. User may want to stop a single subscription but not all of the topics he's subscribed.
Moreover, this decision is a user one. I don't see how it could be done without this user to be online.

Here is the code of my Receiver class. It's not clean, but I try everything, adding and deleting lines until it's good.

When a client subscribes to a Topic, there is one connection for this Topic. So, for a given client subscribed to 3 topics (for instance), 3 ClientID are needed because 3 connections are needed.
A ClientID has to be unique because it identifies one connection of one client for one topic.

That's why I had so many JMSExceptions telling that Durable Consumer was In Use when I wanted to end its subscription.