I’m looking for a way to implement a custom Spring scope which holds objects for the duration of an asynchronous boundary/continuation. That can be both, either a job or the start of a process or a message correlation. Whenever one or more tasks are being executed as one unit of work (one transaction), I’d like to cache some beans/objects in that scope.
I tried transient process variables, but ultimately, even though they are not being persisted, then are serialized which defeats the purpose (I want the original bean, not some serialized version).
Alternatively I was hoping to find a way to register a listener for some events, but seems like there isn’t an event (or rather two) that I can subscribe to.
What’s the best way forward?