-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
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.Salesendpoint, have theSubmitOrderHandlerthrow an exception.
When your run this sample, check SC, notice that the message goes into theFailedErrorImportscollection.
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
- Error messages don't contain
ProcessingEndpointheader only audit messages do, so this condition won't be satisfied:
https://github.com/Particular/ServiceControl/blob/master/src/ServiceControl/Infrastructure/TransportMessageExtensions.cs#L13 - Because a send-only endpoint sent this message, the
ReplyToAddresswill be null
https://github.com/Particular/ServiceControl/blob/master/src/ServiceControl/Infrastructure/TransportMessageExtensions.cs#L18
Therefore we are always throwing anInvalidOperationExceptionin this case