ralscha / sse-eventbus

EventBus library for sending events from a Spring appliction to the web browser with SSE
Apache License 2.0
82 stars 28 forks source link

Whether to support deployment on multiple servers or microservices in spring cloud #21

Closed wideweide closed 2 years ago

wideweide commented 2 years ago

n order to improve concurrency, sometimes you need to deploy a plurality of spring cloud microservices, but SseEmitter is created in the microservices example of a static variable, sse-event can be deployed in multiple microservices node for use? How to navigate to a specific instance then to send message?

ralscha commented 2 years ago

What I did in one project is implement a pub/sub between the instances with Redis and Redisson. When one instance emits an event it publishes it to all other instances and each instance then sends the message to the sse clients.

wideweide commented 2 years ago

thanks for reply, pub/sub is a useful solution. Do you test the SseEmitter's Concurrency? It seems https://www.nginx.com/resources/wiki/modules/push_stream support sse/event source,more simple,more concurrency..

ralscha commented 2 years ago

There is a test with multiple subscribers.

The nginx module looks interesting.

For a new project I would check out Centrifugal. https://centrifugal.dev/

wideweide commented 2 years ago

There is a test with multiple subscribers.

The nginx module looks interesting.

For a new project I would check out Centrifugal. https://centrifugal.dev/

thanks for suggest It seems SseEmitter is not a good choice, and found another choise nchan : kind of like centifugal

How to choose is a problem now...