private static void CreateAndBind_DirectExchange(RabbitMQ.Client.IModel RabbitMqModel)
 {
     var directExchange1 = rabbitMqDefinationFunctions.CreateAndBindExchange(
         RabbitMqModel,
         new ExchangeModel
     {
         ExchangeName = "directExchange1",
         ExchangeType = ExchangeType.Direct,
         Durable      = true,
         AutoDelete   = false
     },
         "directExchange1routeKey1",
         new QueueModel
     {
         QueueName  = "queue1",
         Durable    = true,
         Exclusive  = false,
         AutoDelete = false
     }
         );
 }
Example #2
0
        public IModel Init()
        {
            try
            {
                // Initialize a connection
                var connection = _rabbitMqDefinationFunctions.CreateConnection(
                    new ConnectionInputModel
                {
                    ClientName = _sinkConfiguration.ClientName,
                    ServerIP   = _sinkConfiguration.RabbitMqHostName,
                    ServerPort = _sinkConfiguration.RabbitMqPort,
                    Username   = _sinkConfiguration.RabbitMqUsername,
                    Password   = _sinkConfiguration.RabbitMqPassword
                });

                var model = _rabbitMqDefinationFunctions.GetModelFromConnection(connection);


                // Be sure to exist the exchange and It's binds
                _rabbitMqDefinationFunctions.CreateAndBindExchange(
                    model,
                    new ExchangeModel
                {
                    ExchangeName = _sinkConfiguration.RabbitMqExchangeName,
                    ExchangeType = _sinkConfiguration.RabbitMqExchangeType
                },
                    _sinkConfiguration.RabbitMqRouteKey,
                    new QueueModel
                {
                    QueueName = _sinkConfiguration.RabbitMqQueueName
                });


                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }