Пример #1
0
 public SendEndpointPipe(SendEndpoint endpoint, IPipe <SendContext <T> > pipe)
 {
     _endpoint = endpoint;
     _pipe     = pipe;
     // ReSharper disable once SuspiciousTypeConversion.Global
     _sendContextPipe = pipe as ISendContextPipe;
 }
Пример #2
0
        Task <ISendEndpoint> CreateSendEndpoint <T>()
            where T : class
        {
            IMessagePublishTopology <T> messageTopology = _publishTopology.GetMessageTopology <T>();

            if (!messageTopology.TryGetPublishAddress(_hostAddress, out var publishAddress))
            {
                throw new PublishException($"An address for publishing message type {TypeMetadataCache<T>.ShortName} was not found.");
            }

            Task <ISendTransport> sendTransportTask = _transportProvider.GetPublishTransport <T>(publishAddress);

            if (sendTransportTask.IsCompletedSuccessfully())
            {
                var sendTransport = sendTransportTask.Result;

                var sendEndpoint = new SendEndpoint(sendTransport, _serializer, publishAddress, _sourceAddress, _sendPipe,
                                                    sendTransport.ConnectSendObserver(_publishObservers));

                return(Task.FromResult <ISendEndpoint>(sendEndpoint));
            }

            async Task <ISendEndpoint> CreateAsync()
            {
                var sendTransport = await sendTransportTask.ConfigureAwait(false);

                var handle = sendTransport.ConnectSendObserver(_publishObservers);

                return(new SendEndpoint(sendTransport, _serializer, publishAddress, _sourceAddress, _sendPipe, handle));
            }

            return(CreateAsync());
        }
Пример #3
0
 public EndpointSendContextPipe(SendEndpoint endpoint, IPipe <SendContext> pipe)
 {
     _endpoint = endpoint;
     _sendPipe = pipe;
 }
Пример #4
0
 public EndpointSendContextPipe(SendEndpoint endpoint)
 {
     _endpoint = endpoint;
 }
Пример #5
0
 public SendEndpointPipe(SendEndpoint endpoint)
 {
     _endpoint        = endpoint;
     _pipe            = default;
     _sendContextPipe = default;
 }