Похожие чаты

Hi everyone i want to reload (recreate) a method bean in

spring but could not find any ways for that. i need to recreate a kafka streams processor bean without restarting. any idea how i can do this?

12 ответов

21 просмотр

How many time and under what condition u wanna it get reloaded?

Alireza-dHb Автор вопроса
Mohammad
How many time and under what condition u wanna it ...

I want to reload it after an api is called so manual trigger

Alireza dHb
I want to reload it after an api is called so manu...

As i know default scope is singleton for beans...so it seems kinda funny but maybe with just using setter somewhere 🤔 ideas is to define a class and annotate it with configuration...api call changes its value and decide what happens in your beans base on that value

Alireza-dHb Автор вопроса
Mohammad
As i know default scope is singleton for beans...s...

the problem is the bean has a signature like this public Function<Flux<Message<File>>, Tuple2<Flux<Message<FileLog>>,Flux<Message<B>>>> so it's a functional interface and i don't think i can convert it to a class so it can hold a state

Alireza dHb
the problem is the bean has a signature like this ...

I think there is a misunderstanding...i mean define something like this : @config Class stateClass{ Private boolean state; } Now in your bean class do this Class yourKafkaClass{ Private stateClass stateclass; @bean anythings a(){ If stateclass.state is true do this else do that } }

Alireza-dHb Автор вопроса

well currently it is implemented like this but it doesn't change when i update the stateClass object

Alireza-dHb Автор вопроса
Mohammad
Did u tried to change bean scope?

no, I was afraid it would impact the performance

Alireza dHb
no, I was afraid it would impact the performance

I am agree...i am out😂happy with debuging

Alireza-dHb Автор вопроса

I feel that you're asking wrong question. Your goal seems to be to reconfigure kafka stream processors by api call. And you assume that bean refreshing should do this. Well, I didn't work with kafka streams in spring-boot, but based on my experience with pretty overengineered kafka (without streams) spring boot glue code and brief checking of kafka streams SB docs, I'm 99% sure that just refreshing bean won't work. The thing is that refreshing a bean just updates its instance in the beans registry. It doesn't force any users of this bean to do anything about it. And I'm sure that the code that builds topology out of all the processors you defined as beans, and starts streams processing, gets invoked only during the startup. In other words, if you refresh some processor bean, nobody will care as nobody will never inject that bean later, as this discovery/injection/build/start happens only once during startup. So, I guess, the only way would be to use kafka streams api directly, without spring-boot/cloud glue code, and rebuild the pipeline programmatically from that endpoint code.

Alireza-dHb Автор вопроса
Dmytro Buryak
I feel that you're asking wrong question. Your goa...

Yeah that's what i come to conclusion with too Thanks for your response

Похожие вопросы

Обсуждают сегодня

For managing user-generated content rights in gaming? 🤯🚀
Brian
37
Do we have a Chinese community here?
迪迦
20
@Aiwan что такое база образца?
Alexey
27
Why binance delisting the token?
🅰🅽🅳🆁🅴🆆
14
Не многие знают, а кто знает, тот уже успел забыть, что в далёком 2004 году эта игра произвела настоящий фурор, настолько революционной была технология, применяемая для её соз...
ICCID
4
Короче я тут узнал полный пиздец Что кучу постов которые я создавал через posted Спустя время не могу редактировать и менять Мол телега возвращае ошибку Это реально так ...
inc.
13
Hi is Atomic wallet safe to exchange btc to xmr?
Regex
19
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
I have LUSD tokens but they haven't pegged back to a dollar. Is there a reason why?
Harry the Hexican
14
Is UniBright Freequity an active live product ? A friend here in Asia was discussing the Tokenisation of RWA’s in his case Real Estate as he’s a developer with numerous overs...
Digital Trust
5
Карта сайта