示例#1
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);
        }
        /// <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();
        }