示例#1
0
 /// <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");
     };
 }
示例#2
0
        private RabbitPublisher(HarePublisherSettings settings)
            : base(settings)
        {
            _send      = new Thread(() => DequeueSend(Cancellation.Token));
            Started    = false;
            MySettings = settings;

            _internalQueue = new ConcurrentQueue <Message>();
            if (MySettings.UseConfirms && MySettings.RequeueMessageAfterFailure)
            {
                OnNAcked += lostMessages =>
                {
                    foreach (var m in lostMessages)
                    {
                        if (m.Failed < 2)
                        {
                            Publish(m.RoutingKey, m.Payload);
                        }
                    }
                }
            }
            ;
        }
        private RabbitPublisher(HarePublisherSettings settings)
            : base(settings)
        {
            _send = new Thread(() => DequeueSend(Cancellation.Token));
            Started = false;
            MySettings = settings;

            _internalQueue = new ConcurrentQueue<Message>();
            if (MySettings.UseConfirms && MySettings.RequeueMessageAfterFailure)
                OnNAcked += lostMessages =>
                {
                    foreach (var m in lostMessages)
                        if (m.Failed < 2)
                            Publish(m.RoutingKey, m.Payload);
                };
        }
 /// <summary>
 /// Raw constructor, you have to do everything yourself
 /// </summary>
 /// <param name="mySettings"> </param>
 /// <param name="exchange">Exchange you will sent message to. It *won't* be created, you have to create it in the redeclareToplogy parameter</param>
 /// <param name="redeclareTopology">Lambda called everytime we need to recreate the rabbitmq oblects, it should be idempotent</param>
 public RabbitPublisher(HarePublisherSettings mySettings, RabbitExchange exchange, Action<IModel> redeclareTopology)
     : this(mySettings)
 {
     _myExchange = exchange;
     RedeclareMyTopology = redeclareTopology;
 }
 /// <summary>
 /// Publish to a PUBLIC exchange
 /// </summary>
 /// <param name="mySettings">Settings used to construct a publisher</param>
 /// <param name="exchange">public exchange you want to connect to</param>
 public RabbitPublisher(HarePublisherSettings mySettings, RabbitExchange exchange)
     : this(mySettings)
 {
     _myExchange = exchange;
     RedeclareMyTopology = _myExchange.Declare;
 }
 /// <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");
     };
 }
示例#7
0
 /// <summary>
 /// Raw constructor, you have to do everything yourself
 /// </summary>
 /// <param name="mySettings"> </param>
 /// <param name="exchange">Exchange you will sent message to. It *won't* be created, you have to create it in the redeclareToplogy parameter</param>
 /// <param name="redeclareTopology">Lambda called everytime we need to recreate the rabbitmq oblects, it should be idempotent</param>
 public RabbitPublisher(HarePublisherSettings mySettings, RabbitExchange exchange, Action <IModel> redeclareTopology)
     : this(mySettings)
 {
     _myExchange         = exchange;
     RedeclareMyTopology = redeclareTopology;
 }
示例#8
0
 /// <summary>
 /// Publish to a PUBLIC exchange
 /// </summary>
 /// <param name="mySettings">Settings used to construct a publisher</param>
 /// <param name="exchange">public exchange you want to connect to</param>
 public RabbitPublisher(HarePublisherSettings mySettings, RabbitExchange exchange)
     : this(mySettings)
 {
     _myExchange         = exchange;
     RedeclareMyTopology = _myExchange.Declare;
 }