Open hrothwell opened 5 months ago
probably, would require implementing a custom scope and binding the scope to a thread. Could probably use AbstractConcurrentCustomScope
I'll do some digging on it at some point this week if I get time, thanks for the lead as to where to look
I did spend some time today digging through this with mostly more questions than answers (wip branch for reference) , but to document some notes / ideas / findings / etc about it:
RequestScope
beans (we have used these in apis for this same purpose), but as I was going through I found myself focusing more on trying to merge the ideas of ThreadLocal
and Refreshable
Refreshable
and thinking if there was possibly some other solution other than a new custom scope. The one idea I had and something that potentially has the use outside of just this example: Allowing for the refreshing of speciic beans before a particular method is called. Something like a @Refreshes(beans = {BeanTypeToRefresh.class}, qualifiers = {/* maybe qualifiers could also be applied in the case of multiple beans of said types */})
method annotation. @Refreshes
. random weekend brain thoughts that I am putting down to not forget:
could it be ThreadLocal but then also have a "refresh" function on the bean that is called every poll loop?
Feature description
We have the ability to make a
@RequestScope
bean in Micronaut which ties a bean to the current HttpRequest the server is executing on, would it be possible to do something similar for a Kafka message/batch of messages/etc?