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); 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?
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.