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);
            }
Example #2
0
        public GrpcReceiveContext(GrpcTransportMessage message, GrpcReceiveEndpointContext receiveEndpointContext)
            : base(false, receiveEndpointContext)
        {
            _body   = message.Body;
            Message = message;

            HeaderProvider = new GrpcHeaderProvider(message.Headers);
        }
 public GrpcReceiveTransport(GrpcReceiveEndpointContext context, string queueName)
 {
     _context   = context;
     _queueName = queueName;
 }