コード例 #1
0
 public KafkaMessageReceiver(ReceiveEndpointContext context, IConsumerLockContext <TKey, TValue> lockContext, IHeadersDeserializer headersDeserializer)
 {
     _context             = context;
     _lockContext         = lockContext;
     _headersDeserializer = headersDeserializer;
     _dispatcher          = context.CreateReceivePipeDispatcher();
 }
コード例 #2
0
            public ReceiveTransportAgent(GrpcReceiveEndpointContext context, string queueName)
            {
                _context   = context;
                _queueName = queueName;

                _dispatcher = context.CreateReceivePipeDispatcher();

                var outputOptions = new BoundedChannelOptions(context.PrefetchCount)
                {
                    SingleWriter = true,
                    SingleReader = true,
                    AllowSynchronousContinuations = true
                };

                _channel = Channel.CreateBounded <GrpcTransportMessage>(outputOptions);

                if (context.ConcurrentMessageLimit.HasValue)
                {
                    _limiter = new ConcurrencyLimiter(context.ConcurrentMessageLimit.Value);
                }

                _consumeDispatcher = Task.Run(() => StartDispatcher());

                var startup = Task.Run(() => Startup());

                SetReady(startup);
            }
コード例 #3
0
 public MediatorSendEndpoint(IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher, ILogContext logContext,
                             SendObservable sendObservers, IReceiveEndpointConfiguration sourceConfiguration, IReceivePipeDispatcher sourceDispatcher)
     : this(configuration, dispatcher, logContext, sendObservers)
 {
     _sourceAddress  = sourceConfiguration.InputAddress;
     _sourceEndpoint = new MediatorSendEndpoint(sourceConfiguration, sourceDispatcher, logContext, sendObservers);
 }
コード例 #4
0
        public InMemoryReceiveTransport(Uri inputAddress, IInMemoryQueue queue, ReceiveEndpointContext context)
        {
            _inputAddress = inputAddress;
            _queue        = queue;
            _context      = context;

            _dispatcher = context.CreateReceivePipeDispatcher();
        }
コード例 #5
0
            public ReceiveTransportAgent(InMemoryReceiveEndpointContext context, IInMemoryQueue queue)
            {
                _context = context;
                _queue   = queue;

                _dispatcher = context.CreateReceivePipeDispatcher();

                _consumerHandle = queue.ConnectConsumer(this);

                Task.Run(() => Startup());
            }
コード例 #6
0
        public Mediator(ILogContext logContext, IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher,
                        IInMemoryReceiveEndpointConfiguration responseConfiguration, IReceivePipeDispatcher responseDispatcher)
        {
            var sendObservable = new SendObservable();

            _endpoint = new MediatorSendEndpoint(configuration, dispatcher, logContext, sendObservable, responseConfiguration, responseDispatcher);

            var clientFactoryContext = new MediatorClientFactoryContext(_endpoint, responseConfiguration.ConsumePipe, responseConfiguration.InputAddress);

            _clientFactory = new ClientFactory(clientFactoryContext);
        }
コード例 #7
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="model">The model context for the consumer</param>
        /// <param name="context">The topology</param>
        public RabbitMqBasicConsumer(ModelContext model, RabbitMqReceiveEndpointContext context)
        {
            _model   = model;
            _context = context;

            _receiveSettings = model.GetPayload <ReceiveSettings>();

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

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            _deliveryComplete = TaskUtil.GetTask <bool>();
        }
コード例 #8
0
        MediatorSendEndpoint(IReceiveEndpointConfiguration configuration, IReceivePipeDispatcher dispatcher, ILogContext logContext,
                             SendObservable sendObservers)
        {
            _dispatcher    = dispatcher;
            _logContext    = logContext;
            _sendObservers = sendObservers;

            _destinationAddress = configuration.InputAddress;
            _publishTopology    = configuration.Topology.Publish;
            _receiveObservers   = configuration.ReceiveObservers;

            _sendPipe            = configuration.Send.CreatePipe();
            _publishSendEndpoint = new MediatorPublishSendEndpoint(this, configuration.Publish.CreatePipe());
        }
コード例 #9
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="client">The model context for the consumer</param>
        /// <param name="context">The topology</param>
        public AmazonSqsMessageReceiver(ClientContext client, SqsReceiveEndpointContext context)
        {
            _client  = client;
            _context = context;

            _receiveSettings = client.GetPayload <ReceiveSettings>();

            _deliveryComplete = TaskUtil.GetTask <bool>();

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            Task.Run(Consume);
        }
コード例 #10
0
        public EventHubDataReceiver(ReceiveEndpointContext context, ProcessorContext processorContext)
        {
            _context          = context;
            _processorContext = processorContext;

            _deliveryComplete = TaskUtil.GetTask <bool>();

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            var prefetchCount = Math.Max(1000, processorContext.ReceiveSettings.CheckpointMessageCount / 10);

            _executor = new ChannelExecutor(prefetchCount, processorContext.ReceiveSettings.ConcurrencyLimit);
        }
コード例 #11
0
        public KafkaMessageReceiver(ReceiveEndpointContext context, ConsumerContext <TKey, TValue> consumerContext)
        {
            _context                 = context;
            _consumerContext         = consumerContext;
            _cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(Stopping);

            _consumerContext.ErrorHandler += HandleKafkaError;

            _deliveryComplete = TaskUtil.GetTask <bool>();

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            Task.Run(Consume);
        }
コード例 #12
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="client">The model context for the consumer</param>
        /// <param name="context">The topology</param>
        public AmazonSqsBasicConsumer(ClientContext client, SqsReceiveEndpointContext context)
        {
            _client  = client;
            _context = context;

            _receiveSettings = client.GetPayload <ReceiveSettings>();

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

            _deliveryComplete = TaskUtil.GetTask <bool>();

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            SetReady();
        }
コード例 #13
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="context">The topology</param>
        public ActiveMqBasicConsumer(SessionContext session, IMessageConsumer messageConsumer, ActiveMqReceiveEndpointContext context)
        {
            _session         = session;
            _messageConsumer = messageConsumer;
            _context         = context;

            _receiveSettings = session.GetPayload <ReceiveSettings>();

            _deliveryComplete = TaskUtil.GetTask <bool>();

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            messageConsumer.Listener += HandleMessage;

            SetReady();
        }
コード例 #14
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="model">The model context for the consumer</param>
        /// <param name="context">The topology</param>
        public RabbitMqBasicConsumer(ModelContext model, RabbitMqReceiveEndpointContext context)
        {
            _model   = model;
            _context = context;

            _receiveSettings = model.GetPayload <ReceiveSettings>();

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

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            _executor = new ChannelExecutor(context.PrefetchCount, context.ConcurrentMessageLimit ?? context.PrefetchCount);

            _deliveryComplete = TaskUtil.GetTask <bool>();

            ConsumerCancelled += OnConsumerCancelled;
        }
コード例 #15
0
        /// <summary>
        /// The basic consumer receives messages pushed from the broker.
        /// </summary>
        /// <param name="model">The model context for the consumer</param>
        /// <param name="context">The topology</param>
        public RabbitMqBasicConsumer(ModelContext model, RabbitMqReceiveEndpointContext context)
        {
            _model   = model;
            _context = context;

            _receiveSettings = model.GetPayload <ReceiveSettings>();

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

            _dispatcher = context.CreateReceivePipeDispatcher();
            _dispatcher.ZeroActivity += HandleDeliveryComplete;

            _deliveryComplete = TaskUtil.GetTask <bool>();

            if (context.ConcurrentMessageLimit.HasValue)
            {
                _limit = new SemaphoreSlim(context.ConcurrentMessageLimit.Value);
            }

            ConsumerCancelled += OnConsumerCancelled;
        }
コード例 #16
0
 public EventHubDataReceiver(ReceiveEndpointContext context, IProcessorLockContext lockContext)
 {
     _context     = context;
     _lockContext = lockContext;
     _dispatcher  = context.CreateReceivePipeDispatcher();
 }
コード例 #17
0
        public EventDataReceiver(ReceiveEndpointContext context)
        {
            _context = context;

            _dispatcher = context.CreateReceivePipeDispatcher();
        }
コード例 #18
0
        public BrokeredMessageReceiver(ReceiveEndpointContext context)
        {
            _context = context;

            _dispatcher = context.CreateReceivePipeDispatcher();
        }
コード例 #19
0
 public EventDataReceiver(ReceiveEndpointContext context)
 {
     _context    = context;
     _dispatcher = new ReceivePipeDispatcher(_context.ReceivePipe, _context.ReceiveObservers, _context.LogContext);
 }