zarusz / SlimMessageBus

Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.
Apache License 2.0
467 stars 78 forks source link

[Host] Publishing to a request/response queue (no replyto header) #271

Closed EtherZa closed 2 months ago

EtherZa commented 2 months ago

Publishing an event to a request/response queue results in an exception being thrown because no ReplyTo header has been set.

MessageBusBase.cs

if (!requestHeaders.TryGetHeader(ReqRespMessageHeaders.ReplyTo, out object replyTo))
{
    throw new MessageBusException($"The header {ReqRespMessageHeaders.ReplyTo} was missing on the message");
}

It could be useful to instead perform a no-op when the header is missing to allow for a single handler to be used by both IRequestResponseBus.Send and IPublishBus.Publish (where the response can be ignored).

zarusz commented 2 months ago

Makes sense to change!

zarusz commented 2 months ago

Closed by #272