Exemplo n.º 1
0
        public void Start()
        {
            var factory = ClientConnectionFactory.CreateConnection("localhost");

            this.channel = factory.CreateModel();

            channel.QueueDeclare("HostQueue", true, false, false, null);
            consumer = ConsumerFactory.CreateConsumer(channel, "HostQueue", Consumer_Received);
        }
Exemplo n.º 2
0
        public bool TryConnect()
        {
            lock (syncRoot)
            {
                if (IsConnected)
                {
                    return(true);
                }

                connection = ClientConnectionFactory.CreateConnection(settings.HostName);

                if (IsConnected)
                {
                    connection.ConnectionShutdown += OnConnectionShutdown;
                    connection.CallbackException  += OnCallbackException;
                    connection.ConnectionBlocked  += OnConnectionBlocked;

                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 3
0
 public RMQConnectionManager(RMQSettings settings)
 {
     this.settings = settings;
     connection    = ClientConnectionFactory.CreateConnection(settings.HostName);
 }