public string Subscribe(ExchangeOptions exchangeOptions, QueueOptions queueOptions, bool autoAck) { amqpChannel = _amqpChannelProvider.GetAMQPChannel(); amqpChannel.ExchangeDeclare(exchangeOptions.Name, exchangeOptions.Type.ToString().ToLower(), exchangeOptions.Durable, exchangeOptions.AutoDelete); amqpChannel.QueueDeclare(queueOptions.Name, queueOptions.Durable, queueOptions.Exclusive, queueOptions.AutoDelete, null); var consumer = new EventingBasicConsumer(amqpChannel); consumer.Received += (sender, e) => { var messageBody = e.Body.ToArray(); var message = Encoding.UTF8.GetString(messageBody); }; amqpChannel.BasicConsume(queueOptions.Name, autoAck, consumer); }
public Publisher(IAMQPChannelProvider aMQPChannelProvider) { _amqpChannelProvider = aMQPChannelProvider; _amqpChannel = _amqpChannelProvider.GetAMQPChannel(); }