示例#1
0
        public DistributorPipeline(IServiceBusConfiguration configuration,
                                   IGetWorkMessageObserver getWorkMessageObserver,
                                   IDeserializeTransportMessageObserver deserializeTransportMessageObserver,
                                   IDistributorMessageObserver distributorMessageObserver,
                                   ISerializeTransportMessageObserver serializeTransportMessageObserver,
                                   IDispatchTransportMessageObserver dispatchTransportMessageObserver,
                                   IAcknowledgeMessageObserver acknowledgeMessageObserver,
                                   IDistributorExceptionObserver distributorExceptionObserver)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(getWorkMessageObserver, nameof(getWorkMessageObserver));
            Guard.AgainstNull(deserializeTransportMessageObserver, nameof(deserializeTransportMessageObserver));
            Guard.AgainstNull(distributorMessageObserver, nameof(distributorMessageObserver));
            Guard.AgainstNull(serializeTransportMessageObserver, nameof(serializeTransportMessageObserver));
            Guard.AgainstNull(dispatchTransportMessageObserver, nameof(dispatchTransportMessageObserver));
            Guard.AgainstNull(acknowledgeMessageObserver, nameof(acknowledgeMessageObserver));
            Guard.AgainstNull(distributorExceptionObserver, nameof(distributorExceptionObserver));

            State.SetWorkQueue(configuration.Inbox.WorkQueue);
            State.SetErrorQueue(configuration.Inbox.ErrorQueue);

            RegisterStage("Distribute")
            .WithEvent <OnGetMessage>()
            .WithEvent <OnDeserializeTransportMessage>()
            .WithEvent <OnAfterDeserializeTransportMessage>()
            .WithEvent <OnHandleDistributeMessage>()
            .WithEvent <OnAfterHandleDistributeMessage>()
            .WithEvent <OnSerializeTransportMessage>()
            .WithEvent <OnAfterSerializeTransportMessage>()
            .WithEvent <OnDispatchTransportMessage>()
            .WithEvent <OnAfterDispatchTransportMessage>()
            .WithEvent <OnAcknowledgeMessage>()
            .WithEvent <OnAfterAcknowledgeMessage>();

            RegisterObserver(getWorkMessageObserver);
            RegisterObserver(deserializeTransportMessageObserver);
            RegisterObserver(distributorMessageObserver);
            RegisterObserver(serializeTransportMessageObserver);
            RegisterObserver(dispatchTransportMessageObserver);
            RegisterObserver(acknowledgeMessageObserver);
            RegisterObserver(distributorExceptionObserver); // must be last
        }
示例#2
0
        public InboxMessagePipeline(IServiceBusConfiguration configuration,
                                    IGetWorkMessageObserver getWorkMessageObserver,
                                    IDeserializeTransportMessageObserver deserializeTransportMessageObserver,
                                    IDeferTransportMessageObserver deferTransportMessageObserver,
                                    IDeserializeMessageObserver deserializeMessageObserver, IDecryptMessageObserver decryptMessageObserver,
                                    IDecompressMessageObserver decompressMessageObserver,
                                    IAssessMessageHandlingObserver assessMessageHandlingObserver, IIdempotenceObserver idempotenceObserver,
                                    IHandleMessageObserver handleMessageObserver, IAcknowledgeMessageObserver acknowledgeMessageObserver,
                                    ISendDeferredObserver sendDeferredObserver, IReceiveExceptionObserver receiveExceptionObserver,
                                    ITransactionScopeObserver transactionScopeObserver)
            : base(getWorkMessageObserver, deserializeTransportMessageObserver, deferTransportMessageObserver,
                   deserializeMessageObserver, decryptMessageObserver, decompressMessageObserver,
                   assessMessageHandlingObserver, idempotenceObserver, handleMessageObserver, acknowledgeMessageObserver,
                   sendDeferredObserver, receiveExceptionObserver, transactionScopeObserver)
        {
            Guard.AgainstNull(configuration, nameof(configuration));

            State.SetWorkQueue(configuration.Inbox.WorkQueue);
            State.SetDeferredQueue(configuration.Inbox.DeferredQueue);
            State.SetErrorQueue(configuration.Inbox.ErrorQueue);

            State.SetDurationToIgnoreOnFailure(configuration.Inbox.DurationToIgnoreOnFailure);
            State.SetMaximumFailureCount(configuration.Inbox.MaximumFailureCount);
        }
示例#3
0
        public OutboxPipeline(IServiceBusConfiguration configuration, IGetWorkMessageObserver getWorkMessageObserver,
                              IDeserializeTransportMessageObserver deserializeTransportMessageObserver,
                              ISendOutboxMessageObserver sendOutboxMessageObserver,
                              IAcknowledgeMessageObserver acknowledgeMessageObserver, IOutboxExceptionObserver outboxExceptionObserver)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(getWorkMessageObserver, nameof(getWorkMessageObserver));
            Guard.AgainstNull(deserializeTransportMessageObserver, nameof(deserializeTransportMessageObserver));
            Guard.AgainstNull(sendOutboxMessageObserver, nameof(sendOutboxMessageObserver));
            Guard.AgainstNull(acknowledgeMessageObserver, nameof(acknowledgeMessageObserver));
            Guard.AgainstNull(outboxExceptionObserver, nameof(outboxExceptionObserver));

            State.SetWorkQueue(configuration.Outbox.WorkQueue);
            State.SetErrorQueue(configuration.Outbox.ErrorQueue);

            State.SetDurationToIgnoreOnFailure(configuration.Outbox.DurationToIgnoreOnFailure);
            State.SetMaximumFailureCount(configuration.Outbox.MaximumFailureCount);

            RegisterStage("Read")
            .WithEvent <OnGetMessage>()
            .WithEvent <OnAfterGetMessage>()
            .WithEvent <OnDeserializeTransportMessage>()
            .WithEvent <OnAfterDeserializeTransportMessage>();

            RegisterStage("Send")
            .WithEvent <OnDispatchTransportMessage>()
            .WithEvent <OnAfterDispatchTransportMessage>()
            .WithEvent <OnAcknowledgeMessage>()
            .WithEvent <OnAfterAcknowledgeMessage>();

            RegisterObserver(getWorkMessageObserver);
            RegisterObserver(deserializeTransportMessageObserver);
            RegisterObserver(sendOutboxMessageObserver);
            RegisterObserver(acknowledgeMessageObserver);
            RegisterObserver(outboxExceptionObserver); // must be last
        }
示例#4
0
        protected ReceiveMessagePipeline(IGetWorkMessageObserver getWorkMessageObserver,
                                         IDeserializeTransportMessageObserver deserializeTransportMessageObserver,
                                         IDeferTransportMessageObserver deferTransportMessageObserver,
                                         IDeserializeMessageObserver deserializeMessageObserver, IDecryptMessageObserver decryptMessageObserver,
                                         IDecompressMessageObserver decompressMessageObserver,
                                         IAssessMessageHandlingObserver assessMessageHandlingObserver, IIdempotenceObserver idempotenceObserver,
                                         IHandleMessageObserver handleMessageObserver, IAcknowledgeMessageObserver acknowledgeMessageObserver,
                                         ISendDeferredObserver sendDeferredObserver, IReceiveExceptionObserver receiveExceptionObserver,
                                         ITransactionScopeObserver transactionScopeObserver)
        {
            Guard.AgainstNull(getWorkMessageObserver, nameof(getWorkMessageObserver));
            Guard.AgainstNull(deserializeTransportMessageObserver, nameof(deserializeTransportMessageObserver));
            Guard.AgainstNull(deferTransportMessageObserver, nameof(deferTransportMessageObserver));
            Guard.AgainstNull(deserializeMessageObserver, nameof(deserializeMessageObserver));
            Guard.AgainstNull(decryptMessageObserver, nameof(decryptMessageObserver));
            Guard.AgainstNull(decompressMessageObserver, nameof(decompressMessageObserver));
            Guard.AgainstNull(assessMessageHandlingObserver, nameof(assessMessageHandlingObserver));
            Guard.AgainstNull(idempotenceObserver, nameof(idempotenceObserver));
            Guard.AgainstNull(handleMessageObserver, nameof(handleMessageObserver));
            Guard.AgainstNull(acknowledgeMessageObserver, nameof(acknowledgeMessageObserver));
            Guard.AgainstNull(sendDeferredObserver, nameof(sendDeferredObserver));
            Guard.AgainstNull(receiveExceptionObserver, nameof(receiveExceptionObserver));

            RegisterStage("Read")
            .WithEvent <OnGetMessage>()
            .WithEvent <OnAfterGetMessage>()
            .WithEvent <OnDeserializeTransportMessage>()
            .WithEvent <OnAfterDeserializeTransportMessage>()
            .WithEvent <OnDecompressMessage>()
            .WithEvent <OnAfterDecompressMessage>()
            .WithEvent <OnDecryptMessage>()
            .WithEvent <OnAfterDecryptMessage>()
            .WithEvent <OnDeserializeMessage>()
            .WithEvent <OnAfterDeserializeMessage>();

            RegisterStage("Handle")
            .WithEvent <OnStartTransactionScope>()
            .WithEvent <OnAssessMessageHandling>()
            .WithEvent <OnAfterAssessMessageHandling>()
            .WithEvent <OnProcessIdempotenceMessage>()
            .WithEvent <OnHandleMessage>()
            .WithEvent <OnAfterHandleMessage>()
            .WithEvent <OnCompleteTransactionScope>()
            .WithEvent <OnDisposeTransactionScope>()
            .WithEvent <OnSendDeferred>()
            .WithEvent <OnAfterSendDeferred>()
            .WithEvent <OnAcknowledgeMessage>()
            .WithEvent <OnAfterAcknowledgeMessage>();

            RegisterObserver(getWorkMessageObserver);
            RegisterObserver(deserializeTransportMessageObserver);
            RegisterObserver(deferTransportMessageObserver);
            RegisterObserver(deserializeMessageObserver);
            RegisterObserver(decryptMessageObserver);
            RegisterObserver(decompressMessageObserver);
            RegisterObserver(assessMessageHandlingObserver);
            RegisterObserver(idempotenceObserver);
            RegisterObserver(handleMessageObserver);
            RegisterObserver(acknowledgeMessageObserver);
            RegisterObserver(sendDeferredObserver);
            RegisterObserver(transactionScopeObserver);

            RegisterObserver(receiveExceptionObserver); // must be last
        }