private static RabbitMQ.Client.IModel InitModel()
 {
     return(rabbitMqDefinationFunctions.GetModelFromConnection(
                new ConnectionInputModel
     {
         ClientName = "ConsoleSampleApp1000",
         ServerIP = "localhost",
         ServerPort = 15672,
         Username = "******",
         Password = "******"
     }));
 }
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;
            }
        }