public void Initialize(MessageQueueConfiguration messageQueueConfiguration) { MessageQueueConfiguration = messageQueueConfiguration; var factory = new ConnectionFactory { HostName = messageQueueConfiguration.HostName, }; Connection = factory.CreateConnection(); Channel = Connection.CreateModel(); Channel.QueueDeclare(queue: messageQueueConfiguration.QueueName, durable: false, exclusive: false, autoDelete: false, arguments: null); var consumer = new EventingBasicConsumer(Channel); consumer.Received += ConsumerOnReceived; Channel.BasicConsume(queue: messageQueueConfiguration.QueueName, autoAck: true, consumer: consumer); }
private MessageQueueConfiguration GetQueueConfiguration() { //TODO to take it from configuration var messageQueueConfiguration = new MessageQueueConfiguration() { HostName = "localhost", }; return(messageQueueConfiguration); }