Quantcast
Viewing all articles
Browse latest Browse all 27036

VS 2010 MQ Connection Drops out - No Retry

I currently have the code below that connects to a Message Queue, when a message is received, it triggers the handler event. All this works really great. There is however one problem. This is when the connection is lost (due to coms etc,) it does not re connect.
I am guessing that this is because it needs to re create the session ?

I am however unsure how to do this, I assume that there must be some way of detecting that the connection is lost and then re creating it

Code:

Dim factory As IConnectionFactory = New NMSConnectionFactory(New Uri("stomp:tcp://URLof MQ"))
Dim connection As IConnection = factory.CreateConnection(user,password)
connection.ClientId = "Test"
Dim session As ISession = connection.CreateSession()
Dim IDTopic As IDestination = session.GetTopic("topic://" & "TopicID")
Dim IDconsumer As IMessageConsumer = session.CreateDurableConsumer(IDTopic, "TestID", "2>1", False)
AddHandler IDconsumer.Listener, AddressOf OnIDMessage
connection.Start()
Console.ReadLine()
connection.Close()


Viewing all articles
Browse latest Browse all 27036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>