Похожие чаты

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 ответов

42 просмотра

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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта