コード例 #1
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="session">The model context for the consumer</param>
        /// <param name="messageConsumer"></param>
        /// <param name="inputAddress">The input address for messages received by the consumer</param>
        /// <param name="receivePipe">The receive pipe to dispatch messages</param>
        /// <param name="receiveObserver">The observer for receive events</param>
        /// <param name="context">The topology</param>
        /// <param name="deadLetterTransport"></param>
        /// <param name="errorTransport"></param>
        public ActiveMqBasicConsumer(SessionContext session, IMessageConsumer messageConsumer, Uri inputAddress, IPipe <ReceiveContext> receivePipe,
                                     IReceiveObserver receiveObserver, ActiveMqReceiveEndpointContext context,
                                     IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
        {
            _session             = session;
            _messageConsumer     = messageConsumer;
            _inputAddress        = inputAddress;
            _receivePipe         = receivePipe;
            _receiveObserver     = receiveObserver;
            _context             = context;
            _deadLetterTransport = deadLetterTransport;
            _errorTransport      = errorTransport;

            _tracker = new DeliveryTracker(HandleDeliveryComplete);

            _receiveSettings = session.GetPayload <ReceiveSettings>();

            _pending = new ConcurrentDictionary <string, ActiveMqReceiveContext>();

            _deliveryComplete = new TaskCompletionSource <bool>();

            messageConsumer.Listener += HandleMessage;

            SetReady();
        }
コード例 #2
0
 public MessageReceiverFilter(IBrokeredMessageReceiver messageReceiver, IReceiveTransportObserver transportObserver, IDeadLetterTransport deadLetterTransport,
                              IErrorTransport errorTransport)
 {
     _messageReceiver    = messageReceiver;
     _transportObserver  = transportObserver;
     DeadLetterTransport = deadLetterTransport;
     ErrorTransport      = errorTransport;
 }
コード例 #3
0
ファイル: Receiver.cs プロジェクト: tamphthanh/MassTransit
        public Receiver(ClientContext context, IBrokeredMessageReceiver messageReceiver, IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
        {
            _context             = context;
            _messageReceiver     = messageReceiver;
            _deadLetterTransport = deadLetterTransport;
            _errorTransport      = errorTransport;

            _tracker          = new DeliveryTracker(HandleDeliveryComplete);
            _deliveryComplete = new TaskCompletionSource <bool>();
        }
コード例 #4
0
 public ActiveMqConsumerFilter(IPipe <ReceiveContext> receivePipe, IReceiveObserver receiveObserver, IReceiveTransportObserver transportObserver,
                               ActiveMqReceiveEndpointContext context, IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
 {
     _receivePipe         = receivePipe;
     _receiveObserver     = receiveObserver;
     _transportObserver   = transportObserver;
     _context             = context;
     _deadLetterTransport = deadLetterTransport;
     _errorTransport      = errorTransport;
 }
コード例 #5
0
        public ActiveMqReceiveEndpointContext CreateReceiveEndpointContext()
        {
            var brokerTopology = BuildTopology(_configuration.Settings);

            IDeadLetterTransport deadLetterTransport = CreateDeadLetterTransport();
            IErrorTransport      errorTransport      = CreateErrorTransport();

            var receiveEndpointContext = new ActiveMqConsumerReceiveEndpointContext(_host, _configuration, brokerTopology);

            receiveEndpointContext.GetOrAddPayload(() => deadLetterTransport);
            receiveEndpointContext.GetOrAddPayload(() => errorTransport);

            return(receiveEndpointContext);
        }
コード例 #6
0
        public RabbitMqReceiveEndpointContext CreateReceiveEndpointContext()
        {
            var brokerTopology = BuildTopology(_configuration.Settings);

            IDeadLetterTransport deadLetterTransport = CreateDeadLetterTransport();
            IErrorTransport      errorTransport      = CreateErrorTransport();

            IModelContextSupervisor supervisor = new ModelContextSupervisor(_host.ConnectionContextSupervisor);

            var receiveEndpointContext = new RabbitMqQueueReceiveEndpointContext(_host, supervisor, _configuration, brokerTopology);

            receiveEndpointContext.GetOrAddPayload(() => deadLetterTransport);
            receiveEndpointContext.GetOrAddPayload(() => errorTransport);

            return(receiveEndpointContext);
        }
コード例 #7
0
        public InMemoryReceiveTransport(Uri inputAddress, IInMemoryQueue queue, IPipe <ReceiveContext> receivePipe, IInMemoryExchange errorExchange,
                                        IInMemoryExchange deadLetterExchange, ReceiveEndpointContext topology)
        {
            _inputAddress = inputAddress;
            _queue        = queue;
            _topology     = topology;
            _receivePipe  = receivePipe;

            _errorTransport      = new InMemoryMessageErrorTransport(errorExchange);
            _deadLetterTransport = new InMemoryMessageDeadLetterTransport(deadLetterExchange);

            _receiveObservable   = new ReceiveObservable();
            _transportObservable = new ReceiveTransportObservable();

            _tracker = new DeliveryTracker(HandleDeliveryComplete);
        }
コード例 #8
0
        public SqsReceiveEndpointContext CreateReceiveEndpointContext()
        {
            var brokerTopology = BuildTopology(_configuration.Settings);

            var headerAdapter = new TransportSetHeaderAdapter <MessageAttributeValue>(new SqsHeaderValueConverter(_hostSettings.AllowTransportHeader),
                                                                                      TransportHeaderOptions.IncludeFaultMessage);

            IDeadLetterTransport deadLetterTransport = CreateDeadLetterTransport(headerAdapter);

            IErrorTransport errorTransport = CreateErrorTransport(headerAdapter);

            var receiveEndpointContext = new SqsQueueReceiveEndpointContext(_host, _configuration, brokerTopology);

            receiveEndpointContext.GetOrAddPayload(() => deadLetterTransport);
            receiveEndpointContext.GetOrAddPayload(() => errorTransport);

            return(receiveEndpointContext);
        }
コード例 #9
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="model">The model context for the consumer</param>
        /// <param name="inputAddress">The input address for messages received by the consumer</param>
        /// <param name="receivePipe">The receive pipe to dispatch messages</param>
        /// <param name="receiveObserver">The observer for receive events</param>
        /// <param name="receiveEndpointContext">The topology</param>
        /// <param name="deadLetterTransport"></param>
        /// <param name="errorTransport"></param>
        public RabbitMqBasicConsumer(ModelContext model, Uri inputAddress, IPipe <ReceiveContext> receivePipe, IReceiveObserver receiveObserver,
                                     RabbitMqReceiveEndpointContext receiveEndpointContext, IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
        {
            _model                  = model;
            _inputAddress           = inputAddress;
            _receivePipe            = receivePipe;
            _receiveObserver        = receiveObserver;
            _receiveEndpointContext = receiveEndpointContext;
            _deadLetterTransport    = deadLetterTransport;
            _errorTransport         = errorTransport;

            _tracker = new DeliveryTracker(HandleDeliveryComplete);

            _receiveSettings = model.GetPayload <ReceiveSettings>();

            _pending = new ConcurrentDictionary <ulong, RabbitMqReceiveContext>();

            _deliveryComplete = new TaskCompletionSource <bool>();
        }
コード例 #10
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="model">The model context for the consumer</param>
        /// <param name="queueUrl"></param>
        /// <param name="inputAddress">The input address for messages received by the consumer</param>
        /// <param name="receivePipe">The receive pipe to dispatch messages</param>
        /// <param name="receiveObserver">The observer for receive events</param>
        /// <param name="context">The topology</param>
        /// <param name="deadLetterTransport"></param>
        /// <param name="errorTransport"></param>
        public AmazonSqsBasicConsumer(ModelContext model, string queueUrl, Uri inputAddress, IPipe <ReceiveContext> receivePipe,
                                      IReceiveObserver receiveObserver, AmazonSqsReceiveEndpointContext context,
                                      IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
        {
            _model               = model;
            _queueUrl            = queueUrl;
            _inputAddress        = inputAddress;
            _receivePipe         = receivePipe;
            _receiveObserver     = receiveObserver;
            _context             = context;
            _deadLetterTransport = deadLetterTransport;
            _errorTransport      = errorTransport;

            _tracker = new DeliveryTracker(HandleDeliveryComplete);

            _receiveSettings = model.GetPayload <ReceiveSettings>();

            _pending = new ConcurrentDictionary <string, AmazonSqsReceiveContext>();

            _deliveryComplete = new TaskCompletionSource <bool>();

            SetReady();
        }
コード例 #11
0
 public MessageSessionReceiverFilter(IBrokeredMessageReceiver messageReceiver, IReceiveTransportObserver transportObserver, IDeadLetterTransport deadLetterTransport,
                                     IErrorTransport errorTransport)
     : base(messageReceiver, transportObserver, deadLetterTransport, errorTransport)
 {
 }
コード例 #12
0
 public SessionReceiver(ClientContext context, IBrokeredMessageReceiver messageReceiver, IDeadLetterTransport deadLetterTransport, IErrorTransport errorTransport)
     : base(context, messageReceiver, deadLetterTransport, errorTransport)
 {
     _context         = context;
     _messageReceiver = messageReceiver;
 }