Hi, I new to ActiveMQ. I trying to build a .NET client by using NMS 1.1 for ActiveMQ 4.1.1. I wrote a simple publisher program by sending two messages. I worked fine then but if I give a Sleep time of 60000(1 min). First message is sent fine, butbefore sending the second message I am getting following error: ======================== System.InvalidOperationException: Error writing to broker. Transport connection is closed. at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command command) : Transport connection error: Error writing to broker. Transport connection is closed. ======================== I did the same exercise with Java API, and it was working fine. Following is the exact code in C# const string TOPIC_NAME = "SampleSubscriptionTopic"; const string BROKER = "tcp://localhost:61616"; const string CLIENT_ID = "ActiveMqFirstSubscriber1"; const string CONSUMER_ID = "ActiveMqFirstSubscriber1";
static void Main(string[] args) { IConnectionFactory factory = new ConnectionFactory(BROKER); IConnection con = factory.CreateConnection(); con.Start(); ISession sess = con.CreateSession(); ActiveMQTopic topic = new ActiveMQTopic(TOPIC_NAME); IMessageProducer prod = sess.CreateProducer(topic); for (int i = 0; i < 2; i++) { ActiveMQTextMessage message = new ActiveMQTextMessage("this is from C# client " + i); prod.Send(message); Console.WriteLine("Message number "+i+" send"); Thread.Sleep(60000); } } catch (Exception ex) { Console.WriteLine(ex); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } Can any one please suggest me what is missing in the above code? -- View this message in context: http://www.nabble.com/Error-writing-to-broker.--Transport-connection-is-closed.-tp21348706p21348706.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.