예제 #1
0
        public Task <BaseCommand> Outgoing(CommandProducer command)
        {
            command.RequestId = _requestId.FetchNext();
            var request = StandardRequest.WithProducerId(command.RequestId, command.ProducerId);

            return(_requests.CreateTask(request));
        }
        private void SetRequestId(BaseCommand cmd)
        {
            switch (cmd.CommandType)
            {
            case BaseCommand.Type.Seek:
                cmd.Seek.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.Lookup:
                cmd.LookupTopic.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.Error:
                cmd.Error.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.Producer:
                cmd.Producer.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.CloseProducer:
                cmd.CloseProducer.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.Subscribe:
                cmd.Subscribe.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.Unsubscribe:
                cmd.Unsubscribe.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.CloseConsumer:
                cmd.CloseConsumer.RequestId = _requestId.FetchNext();
                return;

            case BaseCommand.Type.GetLastMessageId:
                cmd.GetLastMessageId.RequestId = _requestId.FetchNext();
                return;
            }
        }