Пример #1
0
        public static Publisher CreatePublisher(string hostName, string queueName)
        {
            var connection    = ConnectionFactory.CreateConection(hostName);
            var requestChanel = ChanelFactory.CreateRequestChanel(queueName, connection);

            return(new Publisher(requestChanel, queueName));
        }
Пример #2
0
        public static Publisher CreatePublisher(string hostName, string queueName, IDictionary <string, object> arguments)
        {
            var connection    = ConnectionFactory.CreateConection(hostName);
            var requestChanel = ChanelFactory.CreateRequestChanel(queueName, connection, arguments);

            return(new Publisher(requestChanel, queueName));
        }
Пример #3
0
        /// <summary>
        /// Creates and returns the Rabbit MQ Listener.
        /// </summary>
        /// <param name="hostName">Rabbit MQ host.</param>
        /// <param name="queueName"></param>
        /// <param name="receivedHandler"></param>
        /// <returns></returns>
        public static Listener CreateListener(string hostName, string queueName, EventHandler <BasicDeliverEventArgs> receivedHandler)
        {
            var connection = ConnectionFactory.CreateConection(hostName);
            var chanel     = ChanelFactory.CreateRequestChanel(queueName, connection);
            var consumer   = ConsumerFactory.RequestConsumer(chanel, queueName);

            return(new Listener(chanel, consumer, queueName, receivedHandler));
        }
Пример #4
0
        public static Publisher CreateResponseSender(string hostName, string queueName)
        {
            var connection     = ConnectionFactory.CreateConection(hostName);
            var responseChanel = ChanelFactory.CreateRequestChanel(queueName, connection);
            var responseSender = new Publisher(responseChanel, queueName);

            responseSender.Type = EventType.Response;
            return(responseSender);
        }
Пример #5
0
        /// <summary>
        /// Creates and returns the Rabbit MQ Listener which can send call-backs
        /// </summary>
        /// <param name="hostName">Rabbit MQ host.</param>
        /// <param name="queueName"></param>
        /// <param name="receivedHandler"></param>
        /// <param name="objectSender"></param>
        /// <returns></returns>
        public static Listener CreateListener(string hostName, string queueName, EventHandler <BasicDeliverEventArgs> receivedHandler, ResponseObjectSender objectSender)
        {
            var connection    = ConnectionFactory.CreateConection(hostName);
            var requestChanel = ChanelFactory.CreateRequestChanel(queueName, connection);
            var sender        = PublisherFactory.CreateResponseSender(hostName, queueName, connection);
            var consumer      = ConsumerFactory.RequestConsumer(requestChanel, queueName);

            return(new Listener(requestChanel, consumer, queueName, receivedHandler, sender, objectSender));
        }
Пример #6
0
        public static Publisher CreatePublisher(string hostName, string queueName,
                                                EventHandler <BasicDeliverEventArgs> responseHandler, IDictionary <string, object> arguments)
        {
            var connection     = ConnectionFactory.CreateConection(hostName);
            var requestChanel  = ChanelFactory.CreateRequestChanel(queueName, connection, arguments);
            var responseChanel = ChanelFactory.CreateResponseChanel(queueName, connection, arguments);
            var consumer       = ConsumerFactory.ReponceConsumer(responseChanel, queueName);

            return(new Publisher(requestChanel, responseChanel, queueName, responseHandler, consumer));
        }