rebus-org / Rebus.Async

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

Timeout Configuration Settings #18

Closed jamshally closed 1 year ago

jamshally commented 1 year ago

Overview

From the InnerProcessRequest method, I see that if a timout is not explicitly provided, it will default to 5 seconds. I would like to develop a PR to add extend the configuration options for RebusAsync to be a little more flexible. This message is to sanity-check the ideas before putting in dev time, and also to get some pointers on implmentation.

Capability/Question 1: Configurable Default Timeout

It looks like EnableSynchronousRequestReply is the place where an additinal optional configuraiton parameter DefaultTimeout could be added. Can you advise on where best to store this value, so that it can then be accessed later in the InnerProcessRequest method (instead of the hard-coded 5 seconds)?

Capability/Question 2: Configure Timeout Per Request/Message Type

It would be useful to configure default timeouts per message type, instead of having to provide timeouts when sending the message. Do you agree with this idea and/or have any input on the specifics of such an implmentation?

Thanks

mookid8000 commented 1 year ago

Can you advise on where best to store this value, so that it can then be accessed later in the InnerProcessRequest method (instead of the hard-coded 5 seconds)?

I'm afraid there's no real good place to store anything, because the SendRequest method is an extension method, and so it has to be static.

My suggestion would be to simply add a publicly accessible static TimeSpan that would store the default timeout, or maybe "upgrade" it to be a callback with a signature like Func<object, Dictionary<string, string>, TimeSpan> which would make it possible to differentiate between e.g. message types or special headers.

Sorry, but the Rebus.Async package is kind of an experiment, it was never meant to be pretty 😉