3
我遇到了ActiveMQ的問題,我嘗試使用MaxReconnectAttemps進行連接,但似乎忽略了屬性。我把一個無效的目的地,所以它試圖連接兩次,但似乎試圖連接無限期。如何在ActiveMQ中使用MaxReconnectAttemps
設置它的任何想法?
感謝,
IConnectionFactory factory = new ConnectionFactory(("failover://(tcp://localhost:61616)?initialReconnectDelay=2000&maxReconnectAttempts=2"));
using (Connection connection = factory.CreateConnection(username,password) as Connection)
{
connection.ClientId = "ClientId";
using (ISession session = connection.CreateSession())
{
IQueue queue = session.GetQueue(queueName);
var producer = session.CreateProducer(queue);
producer.DeliveryMode = MsgDeliveryMode.Persistent;
ITextMessage request = session.CreateTextMessage("Hello World!");
producer.Send(request);
}
}
謝謝一堆...那工作....我以爲我在閱讀文檔時試過這個選項... – pmeyer