Похожие чаты

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

24 просмотра

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

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

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

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
70
Добрый день, не подскажите, если в OC-V3 поменять страндартную директорию /storage/ на /storage2/ - не будет сильно много проблем ?
Max Dubovsky
32
Хотел бы спросить у знающих, правильную ли я выбрал книгу для начала изучения ассемблера Юрова В.И ? Или есть более лучшие книги для начала обучения?
Botsman
25
Conversation at a festival with a non-crpto person (not a normie by any stretch, though): * person: tell me about crypto, me: ok, the original idea is p2p sound money for the...
molecular#123 🐓
25
Книга Юрова В.И пойдёт для обучения?
Botsman
24
Люди добрые, помогите с идеями, потому что свои закончились. У клиента падает софтина в момент инициализации модуля OtlEventMonitor на RegisterWindowMessage('Gp/OtlTaskEvents/...
Михаил Усков
7
$params = [ 'formid' => 'feedbackForm', 'formTpl' => '@CODE: <form class="form-validate" data-id="ajax_form"> <fieldset class="margin-bottom-md"> ...
Pathologic
1
> Примечательно, что новый владелец удаляет из GitHub любые жалобы, указывающие на подозрительную активность или смену владельца, и, видимо, рассчитывает на то, что пользовате...
Alex Sherbakov
2
Today, DENT achieved a significant step forward in DENTX adoption 🥳 Getting DENTX and starting staking is much easier: DENTX is available on Uniswap! Everyone can swap their ...
Thomas
3
I bought some PHA tokens on Kucoin, which is the best wallet to store and easy to use?
AMR
19
Карта сайта