Spring custom poller using dynamic max message per poll value

185 views Asked by At

I am developing an SMPP platform that has to be capable to delivere specific amount of sms per second.

This has been easily implemented using amqp with spring integration.

But:

I need to run the project as an active-active service on 2 nodes and each node has a connection to 2 SMSC. For this configuration, I have an allowed traffic of 100 msg/s and I need to ideally spread my traffic on all the available connections.

A simple poller can be easily configured to 25 msg/s for each node (4 * 25 = 100) but if one of my connection is down, I want to spread the lost capacity to the other nodes/connections in live.

For this I would like to create a dynamic poller that gets information about connection status in redis and just adapts the amount of messages allowed per poll at runtime (0 for the broken connection and 33% for the 3 others for example, or 50% if there is only 2 connections on 4 available).

Is it possible to implement this behavior with a custom PollerMetadata or should I look for some other solution?

1

There are 1 answers

0
Huy Nguyen On

Poll is quite heavy and may be consider "old-fashion" these day.

I highly recommend to try using : Sse (server send event) or websocket.

Many technology also support both above solution (spring...)

You can find more detail in this article:

https://codeburst.io/polling-vs-sse-vs-websocket-how-to-choose-the-right-one-1859e4e13bd9