Closed boskjoett closed 1 year ago
Oh yeah sorry, I forgot to mention it in the changelog.
I removed it because I have never believed that "publishing a request" should be something anyone should ever have to do.
It raises too many questions. E.g. when you "publish" something, you should not care how many from 0..n subscribers receive the published event, when when you "publish a request" you would need only one single reply (at least that's how it works – if two subscribers were to reply, you would only receive the first).
If what you really want is to request something from multiple parties and then go with the one that anwers first, .NET has the nifty Task.WhenAny
that can help you. Combined with the new explicit routing method, you can write code like this:
var routing = bus.Advanced.Routing;
var request = new SomeRequest();
var response = await Task.WhenAny(
routing.SendRequest<SomeResponse>("service1", request),
routing.SendRequest<SomeResponse>("service2", request),
routing.SendRequest<SomeResponse>("service3", request)
);
and then response
would simply contain the first response.
Are you using PublishRequest
? And may I ask what for?
We were using PublishRequest, but now we use SendRequest. I agree that it is a better approach.
Great! 🙂
Sorry for any inconvenience it may have caused.
May I ask why you decided to remove the PublishRequest method in version 9.0? Maybe that should be mentioned in the CHANGELOG.