public IConnection CreateConnection(string exchange)
        {
            if (string.IsNullOrWhiteSpace(exchange))
            {
                throw new ArgumentNullException(nameof(exchange));
            }

            try
            {
                var connection = _connectionFactory.CreateConnection();
                return(new RabbitMQConnection(exchange, connection));
            }
            catch (Rabbit.Exceptions.BrokerUnreachableException ex)
            {
                throw new BrokerUnreachableException(ex.Message, ex);
            }
        }
        static void Main(string[] args)
        {
            if (doMongoInsert)
            {
                Console.WriteLine($"Listening for events from rabbit :)");

                _connectionFactory = new ConnectionFactory {
                    HostName = "localhost"
                };
                _connection = _connectionFactory.CreateConnection();

                _mongoSetting    = new MongoSetting();
                _mongoRepository = new MongoRepository(_mongoSetting);

                var sub = new Subscriber(_connection, _mongoRepository);
            }

            Console.WriteLine($"Mode to process set to : {doMongoInsert}");
            Console.Read();
        }
Exemple #3
0
 public virtual IConnection CreateConnection()
 {
     return(_connectionFactory.CreateConnection());
 }