Caches the converters that allow a raw object to be published using the object's type through the generic Send method.
예제 #1
0
        public virtual async Task RespondAsync(object message, Type messageType, IPipe <SendContext> sendPipe)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (messageType == null)
            {
                throw new ArgumentNullException(nameof(messageType));
            }

            if (sendPipe == null)
            {
                throw new ArgumentNullException(nameof(sendPipe));
            }

            if (ResponseAddress != null)
            {
                var endpoint = await GetSendEndpoint(ResponseAddress).ConfigureAwait(false);

                await SendEndpointConverterCache.Send(endpoint, message, messageType, new ResponsePipe(this, sendPipe), CancellationToken)
                .ConfigureAwait(false);
            }
            else
            {
                await Publish(message, messageType, new ResponsePipe(this, sendPipe), CancellationToken).ConfigureAwait(false);
            }
        }
예제 #2
0
        public Task Send(object message, CancellationToken cancellationToken)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var messageType = message.GetType();

            return(SendEndpointConverterCache.Send(this, message, messageType, cancellationToken));
        }
예제 #3
0
        public Task Send(object message, Type messageType, IPipe <SendContext> pipe, CancellationToken cancellationToken)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (messageType == null)
            {
                throw new ArgumentNullException(nameof(messageType));
            }

            if (pipe == null)
            {
                throw new ArgumentNullException(nameof(pipe));
            }

            return(SendEndpointConverterCache.Send(this, message, messageType, pipe, cancellationToken));
        }