Behaviour of Vert.x Event-bus when reaching the limit

我们两清 提交于 2020-12-13 03:26:12

问题


I'm missing one piece of understanding of how Event Bus / Hazelcast works.

Imagine a case with a consumer and a producer verticles communicating over the clustered EB. The consuming part is doing CPU / memory / IO-intensive calculations.

When at some point due to the load the consumer is not able to handle the messages immediately, what is going to happen?

Would the messages be queueed inside the ring-buffer and eventually be processed later (considering Netty's SingleThreadEventLoop limits of 2 billion as per Size of event bus in vert.x)? Will they be dropped in case of reaching the limit?

In general, can the messages in EB be considered persistent and with delivery guarantee, as soon as no component in the cluster crashes?


回答1:


If the consumers cannot cope with the messages, Vert.x will accumulate messages in a queue in memory.

When the queue reaches its limit, the messages will be dropped. The number of elements in the queue can be configured with MessageConsumer.html#setMaxBufferedMessages. It does not depend on message size.

If you need delivery guarantees, don't use the EventBus, use a messaging system like ActiveMQ (Vert.x has clients for such messaging systems).

In general, Vert.x does its best not to lose messages but the EventBus is simply not a full-featured messaging system.



来源:https://stackoverflow.com/questions/59266097/behaviour-of-vert-x-event-bus-when-reaching-the-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!