Skip to content

When a message that is sent by a SendOnly endpoint lands in the error queue when processing, SC does not import the error message properly. #405

@indualagarsamy

Description

@indualagarsamy

When a send-only self hosted endpoint send a message to another NSB endpoint and handling of this message by this endpoint results in an error, then ServiceControl does not import the error message properly and gets added to the FailedErrorImports collection and therefore does not raise proper notifications in ServicePulse.

Related Google group post:
https://groups.google.com/forum/#!topic/particularsoftware/fNkyaRCwBq0

Steps to reproduce

  • In the RabbitMQ videostore, create a send-only self hosted endpoint with initialization as follows:
static void Main(string[] args)
        {
            var busConfiguration = new BusConfiguration();
            busConfiguration.UseSerialization<JsonSerializer>();
            busConfiguration.EnableInstallers();
            busConfiguration.UseTransport<RabbitMQTransport>();
            busConfiguration.Conventions()
                .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Commands"))
                .DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Events"))
                .DefiningMessagesAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("RequestResponse"));
                      var bus = Bus.CreateSendOnly(busConfiguration);
            bus.Send("VideoStore.Sales", new SubmitOrder()
            {
                ClientId = "1001",
                EncryptedCreditCardNumber = "89009",
                EncryptedExpirationDate = "10/1",
                OrderNumber = 1,
                VideoIds = new string[]
                {
                    "Getting Started"
                }
            });

            Console.ReadLine();
        }
  • In the VideoStore.Sales endpoint, have the SubmitOrderHandler throw an exception.
    When your run this sample, check SC, notice that the message goes into the FailedErrorImports collection.

Exception posted by the user:

Exception:
No processing endpoint could be determined for message (Direct.Bridge.Messages.Out.Response.ProcessMDN, Direct.Bridge.Shared, Version=3.0.0.567, Culture=neutral, PublicKeyToken=null)
StackTrace:
   at ServiceControl.TransportMessageExtensions.UniqueId(TransportMessage message) in c:\BuildAgent\work\b7f882efc2cd360b\src\ServiceControl\Infrastructure\TransportMessageExtensions.cs:line 34
   at ServiceControl.Contracts.Operations.ImportMessage..ctor(TransportMessage message) in c:\BuildAgent\work\b7f882efc2cd360b\src\ServiceControl\Contracts\Operations\ImportMessage.cs:line 12
   at ServiceControl.Contracts.Operations.ImportFailedMessage..ctor(TransportMessage message) in c:\BuildAgent\work\b7f882efc2cd360b\src\ServiceControl\Contracts\Operations\ImportFailedMessage.cs:line 10
   at ServiceControl.Operations.ErrorQueueImport.InnerHandle(TransportMessage message) in c:\BuildAgent\work\b7f882efc2cd360b\src\ServiceControl\Operations\ErrorQueueImport.cs:line 36
   at ServiceControl.Operations.ErrorQueueImport.Handle(TransportMessage message) in c:\BuildAgent\work\b7f882efc2cd360b\src\ServiceControl\Operations\ErrorQueueImport.cs:line 31
   at NServiceBus.Satellites.SatelliteLauncher.HandleMessageReceived(Object sender, TransportMessageReceivedEventArgs e, ISatellite satellite) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Satellites\SatelliteLauncher.cs:line 92
   at NServiceBus.Unicast.Transport.TransportReceiver.OnTransportMessageReceived(TransportMessage msg) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 453   at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 390
   at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 260
   at NServiceBus.Transports.RabbitMQ.RabbitMqDequeueStrategy.Action(Object obj)

Root cause

  1. Error messages don't contain ProcessingEndpoint header only audit messages do, so this condition won't be satisfied:
    https://github.com/Particular/ServiceControl/blob/master/src/ServiceControl/Infrastructure/TransportMessageExtensions.cs#L13
  2. Because a send-only endpoint sent this message, the ReplyToAddress will be null
    https://github.com/Particular/ServiceControl/blob/master/src/ServiceControl/Infrastructure/TransportMessageExtensions.cs#L18
    Therefore we are always throwing an InvalidOperationException in this case

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions