/// <summary> /// Create a rabbitconsumer which will consume message from a PUBLIC exchange. This exchange is supposed to be direct/fanout (otherwise use the raw constructor) /// </summary> /// <param name="settings">Settings used to construct the consumer</param> /// <param name="exchange">the exchange you want to listen to</param> public RabbitConsumer(HareConsumerSettings settings, RabbitExchange exchange) : this(settings) { _myQueue = new RabbitQueue(GetUniqueIdentifier(exchange.Name)) { AutoDelete = true }; RedeclareMyTopology = m => { exchange.Declare(m); _myQueue.Declare(m); m.QueueBind(_myQueue.Name, exchange.Name, "noRKrequired"); }; }
/// <summary> /// Publish to a PUBLIC queue /// </summary> /// <param name="mySettings">Settings used to construct a publisher</param> /// <param name="destinationQueue">public queue you want to connect to</param> public RabbitPublisher(HarePublisherSettings mySettings, RabbitQueue destinationQueue) : this(mySettings) { _destinationQueue = destinationQueue; _myExchange = new RabbitExchange(destinationQueue.Name + "-" + "exchange") { AutoDelete = true }; RedeclareMyTopology = m => { _myExchange.Declare(m); destinationQueue.Declare(m); m.QueueBind(destinationQueue.Name, _myExchange.Name, "noRKneeded"); }; }
/// <summary> /// Create a rabbitconsumer which will consume message from a PUBLIC exchange. This exchange is supposed to be direct/fanout (otherwise use the raw constructor) /// </summary> /// <param name="settings">Settings used to construct the consumer</param> /// <param name="exchange">the exchange you want to listen to</param> public RabbitConsumer(HareConsumerSettings settings, RabbitExchange exchange) : this(settings) { _myQueue = new RabbitQueue(GetUniqueIdentifier(exchange.Name)) { AutoDelete = true }; RedeclareMyTopology = m => { exchange.Declare(m); _myQueue.Declare(m); m.QueueBind(_myQueue.Name, exchange.Name, "noRKrequired"); }; }
/// <summary> /// Publish to a PUBLIC queue /// </summary> /// <param name="mySettings">Settings used to construct a publisher</param> /// <param name="destinationQueue">public queue you want to connect to</param> public RabbitPublisher(HarePublisherSettings mySettings, RabbitQueue destinationQueue) : this(mySettings) { _myExchange = new RabbitExchange(destinationQueue.Name + "-" + "exchange") { AutoDelete = true }; RedeclareMyTopology = m => { _myExchange.Declare(m); destinationQueue.Declare(m); m.QueueBind(destinationQueue.Name, _myExchange.Name, "noRKneeded"); }; }