Похожие чаты

Hey, I would need a little recommendation, I will describe

the process shortly:

I have a master spawning x goroutines with endless loops. They are running the whole time like a service, so let’s call them services. Now I need a way to communicate with them, like a „service bus“(?). I thought about creating a channel for each service but then I would have to make another routine for each service because it would block then.

So what do I need? A communication with each service. Doesn’t really matter if it’s only for a service stop or other things.

13 ответов

11 просмотров

https://levelup.gitconnected.com/lets-write-a-simple-event-bus-in-go-79b9480d8997

Emalia- Автор вопроса
Mr. T
https://levelup.gitconnected.com/lets-write-a-simp...

Yeah I read that. That was the channel approach for each service with an additional routine

Pub/Sub architecture?

Emalia- Автор вопроса
Antonio Di Pinto
Pub/Sub architecture?

Yes that’s the architecture I found too, also the one which Mr. t linked

what exactly are your requirements?

Emalia- Автор вопроса
Roman Sharkov
what exactly are your requirements?

My master has to talk with specific goroutines: if I want to talk with (let’s pretend they have ids) ID 5, I have to communicate with the certain service (goroutine), and do specific tasks. That’s why my first approach was a channel for each service where I can send data to the individual goroutine, maybe stored in a map with ID:Channel on my master thread. I just had no clue if that’s a good way to do. Now I will research a bit more about the mentioned architecture above, maybe that’s fitting - or maybe you have another idea. With the current idea I could say ”send message to channel services[5]“ (where 5 is the ID). Does that make sense? If not I will try to elaborate a bit different.

Emalia
My master has to talk with specific goroutines: i...

Is the communication bidirectional? Between workers and master

Emalia- Автор вопроса
Emalia- Автор вопроса
Roman Sharkov
so what’s the problem with channels?

It’s more like a "shouldn’t there be a better way to solve that instead of having two routines for each service/worker"

Emalia
It’s more like a "shouldn’t there be a better way ...

I still don’t understand why you need two goroutines

Emalia- Автор вопроса
Emalia
Explained in my new answer

could you please point me to it?

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
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
Карта сайта