public void Handle(Envelope <TPayload> message)
 {
     try
     {
         _inner.Handle(message);
         message = message.RedirectToTopic(_outputTopic);
         _messageBus.PublishEnvelope(message);
     }
     catch (Exception e)
     {
         _messageBus.Publish(_errorTopic, new NodeErrorMessage <TPayload>(_nodeKey, message.Payload, e));
     }
 }
        public async Task Handle <TCommand>(TCommand command)
        {
            this.logger.LogInformation("Message Received: {@Message}", command);
            using var scope = this.serviceProvider.CreateScope();

            ISubscriptionHandler <TCommand> handler = scope.ServiceProvider.GetRequiredService <ISubscriptionHandler <TCommand> >();

            try
            {
                await handler.Handle(command).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                this.logger.LogError(e, "Message handler failed");
            }
        }
示例#3
0
 public void Invoke(Envelope <TPayload> message)
 {
     _handler.Handle(message);
 }