Error while connecting to Tibco topic from .net - ClientId already exists

using a c# client am subscribing to a Tibco topic using a durable subscriber. am using below code

TopicConnectionFactory factory = new TIBCO.EMS.TopicConnectionFactory(serverUrl);
TopicConnection connection = factory.CreateTopicConnection(userName, password);
connection.ClientID = clientID;
TopicSession session = connection.CreateTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.CreateTopic(topicName);
TopicSubscriber subscriber = session.CreateDurableSubscriber(topic, durableName); 

When the program runs for the first time, the above code is working fine and am able to receive the messages. but when i stop my client program and try to run it again, then from now onwards, am not able to connect to topic at all. it is giving me a error

ClientId already exists at line
connection.ClientID = clientID;

am not sure what is the role of clientId. do i need to give unique clientid each time i connect to TOPIC?

kindly help.

Thanks in advance.


In general, every connection should have a unique clientId. Otherwise you'll get "ClientId already exists" if there is already a connection having the same clientId.

I finally found the solution to this. instead of Receive method, i used a method ReceiveNoWait method, then all worked fine.

Need Your Help

jQuery div slide to left on hover a div/nextarrow

javascript jquery css

I am trying to implement something like this (slider -> arrow on hover)

How can I shutdown Spring task executor/scheduler pools before all other beans in the web app are destroyed?

java spring threadpool

In a Spring web application I have several DAO and service layer beans. One service layer bean has annotated @Async / @Scheduled methods. These methods depend on other (autowired) beans.