-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@PollScope - specialized @ThreadLocal beans to refresh each poll #1041
base: 5.5.x
Are you sure you want to change the base?
Conversation
…omplish what I want or need also
so I am unsure as well since this PR doesn't run bean destruction hooks. The question is if you want to run those hooks at the end of the execution or only when the application shutdowns |
Also sounds like you want beans recreated. This PR will probably not work for constructor injection, calling |
Really I don't think that for my exact current use case I care about recreating the bean, just that the values of it are refreshed. I figured that just recreating the beans might be the easiest and best way for the long term to handle that. I am working on another solution for my own use case and what I come up with for that might lead to more ideas / use cases here. Will include some more details after I figure out some of those details and if it actually works in my use case I am working around. |
example branch of a solution that albeit technically works for my use case I described, feels like there could be some better solution that would also benefit others or be more reusable. The plan with that approach would be to annotate our function that handles message processing with @RefreshesThreadLocal |
Initial attempt at addressing #1017
PollScope
annotation which is essentially justThreadLocal
but renamed for gaining access via qualifiersrefreshPollScopeBeans()
toKafkaConsumerProcessor
- intending to refresh allPollScope
beans for the current consumer / thread that is executingrefreshPollScopeBeans
fromConsumerState
right before record processing beginsI am definitely unsure if
refreshPollScopeBeans
will behave even remotely closely to how I am hoping (hence the TODO above it), and I appear to be unable to run any tests locally (have a docker env setup, can tell that it pulls and starts a kafka container, but appears to never inject or setkafka.bootstrap.servers
). All things I will/plan to look into but still wanted to get this up as a draft for now