Start() public method

Starts asynchronous message delivery of incoming messages for this connection. Synchronous delivery is unaffected.
public Start ( ) : void
return void
        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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void Start()
 {
     connection.Start();
 }