Domanda

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); 
connection.Start();

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.

È stato utile?

Soluzione 2

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top