Похожие чаты

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

33 просмотра

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

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

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

"Since pnut can flip FTM easily, I'm swapping my FTM to pnut and hoping for a easy x5-x10" Perfect recipe for disaster. NFA but chances are, you'll end up as exit liquidity ...
C. A.
7
Всем привет! Имеется функция: function IsValidChar(ch: UTF8Char): Boolean; var i: Integer; ValidChars: AnsiString; begin ValidChars := 'abcdefghijklmnopqrstuvwxyzABCDE...
Евгений
35
Добрый день, подскажите, пожалуйста, по проблеме. Сегодня на работе утром обнаружилось что по рдп подключиться не получается к серверу 2022. В серверную зашел - на системно...
srv
19
лучше скажите, причём тут паскаль?
Alexey Kulakov
36
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Welcome Mary Clark to the Pirate Chain chat Matey ☠️ PIRATE CHAIN is a cryptocurrency for private anonymous transactions. Official website https://piratechain.com ⚠️ Beware...
Rose
1
Ребят, где можно найти ЕБИлд последней версии Budgie DE? Или нет такого?
HyperWin
13
День добрый, подскажите пожалуйста, есть ли какой-то способ сказать ребару не компилировать определённое приложение? Всю доку их перечиатл ничего подобного не нашёл
Кирилл
14
Народ! Впервые клиенту пришло письмо от РКН, у вас, дескать, есть яндекс метрика, а нигде не написано, что вы ее юзаете. Никто не сталкивался?
Sasha Beep
10
Добрый вечер. Хочу чтобы у меня в классе поле было функцией, которая возвращает строку. Делаю так: interface ... TGetOutPath = function : String of object; ... protec...
Kirill Filippenok
12
Карта сайта