Exemplo n.º 1
0
        public async Task StartConsumeAsync()
        {
            RMQConnector rmq = new RMQConnector(rmq_host, rmq_port, rmq_vhost, rmq_login, rmq_password, rmq_queue);

            Assert.IsTrue(rmq.Connect());

            OneCConnector oneC = new OneCConnector(oneC_server, oneC_baseName, oneC_login, oneC_password);

            Assert.IsTrue(oneC.Connect());

            Channel <Message> messages = Channel.CreateUnbounded <Message>();
            Channel <Message> acks     = Channel.CreateUnbounded <Message>();

            try
            {
                rmq.StartConsume(messages, acks);
                await oneC.StartConsumeAsync(messages, acks);
            }
            catch { }
            finally
            {
                rmq.Close();
                oneC.Close();
                messages.Writer.Complete();
                acks.Writer.Complete();
            }
        }
Exemplo n.º 2
0
        public void RMQ_Connect()
        {
            RMQConnector instance = new RMQConnector(rmq_host, rmq_port, rmq_vhost, rmq_login, rmq_password, rmq_queue);
            bool         isOpen   = instance.Connect();

            Assert.IsTrue(isOpen);
            instance.Close();

            instance = new RMQConnector(rmq_host, 1111, rmq_vhost, rmq_login, rmq_password, rmq_queue);
            isOpen   = instance.Connect();
            Assert.IsFalse(isOpen);
        }