private void init(string host, int port) { ReceivedNumber = 0; isFinished = false; ReceivedMessages = new List<string>(); ListionTopics = new List<string>(); Uri uriSample = new Uri("activemq:tcp://" + host + ":" + port); ConnectionFactory confSample = new ConnectionFactory(uriSample); connection = (Connection)confSample.CreateConnection(); connection.Start(); session = (Session)connection.CreateSession(); }
public void FailoverTransportFailOnProcessingReceivedMessageTest() { string uri = "failover:(tcp://${activemqhost}:61616)"; IConnectionFactory factory = new ConnectionFactory(NMSTestSupport.ReplaceEnvVar(uri)); using(connection = factory.CreateConnection() as Connection ) { connection.ConnectionInterruptedListener += new ConnectionInterruptedListener(TransportInterrupted); connection.ConnectionResumedListener += new ConnectionResumedListener(TransportResumed); connection.Start(); using(ISession session = connection.CreateSession()) { IDestination destination = session.GetQueue("Test?consumer.prefetchSize=1"); PurgeQueue(connection, destination); PutMsgIntoQueue(session, destination); using(IMessageConsumer consumer = session.CreateConsumer(destination)) { consumer.Listener += OnMessage; BreakConnection(); WaitForMessagesToArrive(); } } } Assert.IsTrue(this.interrupted); Assert.IsTrue(this.resumed); }
public void Start() { connection.Start(); }