rebus-org / Rebus.Async

:bus: Experimental async extensions for Rebus
https://mookid.dk/category/rebus
Other
13 stars 9 forks source link

PublishRequest #24

Closed StefanStsc closed 1 year ago

StefanStsc commented 1 year ago

I've to come back to this question: https://github.com/rebus-org/Rebus.Async/issues/23

In my case the destination queue name is dynamically generated and hard to configure somewhere. I would need the PublishRequest function back.

Is that somehow possible? Thanks

mookid8000 commented 1 year ago

Hi @StefanStsc ,

I removed the method because I have always felt that "publishing a request" did not make any sense, because there's a huge conflict between "requesting something" and the properties you would normally attribute to the act of "publishing an event".

When you "send a request", the sender does it in its own interest – it cares about the message and will wait for a response to return.

When you "publish an event", the publisher doesn't do it in its own interest – it does it to do other apps a favor, but it doesn't care whether there's 0..n subscribers receiving it.

I suggest you change your code to something similar to this:

var queueName = FigureOutWhereToSendTheRequest();

var routing = bus.Advanced.Routing;
var response = await routing.SendRequest<SomeResponse>(queueName, new SomeRequest());

or, if you really want the PublishRequest method, you're free to fork the repo and maintain it in your own version of the package.

Sorry if this is not ideal for you, but I cannot deny to be an arbiter of taste when it comes to everything Rebus, and I sometimes need to make decisions that not everyone may like.