Ejemplo n.º 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");
     };
 }
Ejemplo n.º 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);
                        }
                    }
                }
            }
            ;
        }
Ejemplo n.º 3
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);
                };
        }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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)
 {
     _myExchange = new RabbitExchange(destinationQueue.Name + "-" + "exchange") { AutoDelete = true };
     RedeclareMyTopology = m =>
     {
         _myExchange.Declare(m);
         destinationQueue.Declare(m);
         m.QueueBind(destinationQueue.Name, _myExchange.Name, "noRKneeded");
     };
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }