Example #1
0
        async Task IPublishEndpoint.Publish <T>(object values, IPipe <PublishContext> publishPipe,
                                                CancellationToken cancellationToken)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            var message = TypeMetadataCache <T> .InitializeFromObject(values);

            var adapter = new PublishPipeContextAdapter <T>(publishPipe, _publishPipe, _publishObserver, _sourceAddress, _correlationId, _conversationId, message);

            try
            {
                var sendEndpoint = await _endpointProvider.GetPublishSendEndpoint(typeof(T)).ConfigureAwait(false);

                await sendEndpoint.Send(message, adapter, cancellationToken).ConfigureAwait(false);

                await adapter.PostPublish().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                await adapter.PublishFaulted(ex).ConfigureAwait(false);

                throw;
            }
        }
Example #2
0
        Task IPublishEndpoint.Publish <T>(object values, CancellationToken cancellationToken)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            var message = TypeMetadataCache <T> .InitializeFromObject(values);

            var adapter = new PublishPipeContextAdapter <T>(_publishPipe, _publishObserver, _sourceAddress, _correlationId, _conversationId, message);

            return(Publish(cancellationToken, message, adapter));
        }
Example #3
0
        async Task Publish <T>(CancellationToken cancellationToken, T message, PublishPipeContextAdapter <T> adapter)
            where T : class
        {
            try
            {
                var sendEndpoint = await _endpointProvider.GetPublishSendEndpoint(message).ConfigureAwait(false);

                await sendEndpoint.Send(message, adapter, cancellationToken).ConfigureAwait(false);

                await adapter.PostPublish().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                await adapter.PublishFaulted(ex).ConfigureAwait(false);

                throw;
            }
        }
        async Task IPublishEndpoint.Publish <T>(T message, IPipe <PublishContext> publishPipe, CancellationToken cancellationToken)
        {
            var adapter = new PublishPipeContextAdapter <T>(publishPipe, _publishObserver, _sourceAddress, _correlationId, _conversationId);

            try
            {
                var sendEndpoint = await _endpointProvider.GetPublishSendEndpoint(typeof(T)).ConfigureAwait(false);

                await sendEndpoint.Send(message, adapter, cancellationToken).ConfigureAwait(false);

                await adapter.PostPublish().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                await adapter.PublishFaulted(ex).ConfigureAwait(false);

                throw;
            }
        }
Example #5
0
        Task IPublishEndpoint.Publish <T>(T message, IPipe <PublishContext> publishPipe, CancellationToken cancellationToken)
        {
            var adapter = new PublishPipeContextAdapter <T>(publishPipe, _publishPipe, _publishObserver, _sourceAddress, _correlationId, _conversationId, message);

            return(Publish(cancellationToken, message, adapter));
        }
Example #6
0
        Task IPublishEndpoint.Publish <T>(T message, CancellationToken cancellationToken)
        {
            var adapter = new PublishPipeContextAdapter <T>(_publishPipe, _publishObserver, _sourceAddress, _consumeContext, message);

            return(Publish(cancellationToken, message, adapter));
        }