JMS消息消费

发布于 2024-11-07 18:34:58 字数 575 浏览 5 评论 0原文

我不确定以下场景中会发生什么,如果有人解释的话将会有很大帮助。

生产者(P)发送消息M1、M2、M3、M4、M5、M6、M7;假设它是从时间T1到T7发送的。

消息消费者(L)将是绑定到主题的侦听器。 主题名称:jmsTopic

场景 1:

JMS 代理正在运行,L 连接到 jmsTopic。 P将M1到M7发送到jmsTopic。如果 L 在时间 T8(大于 T7)连接到 jmsTopic,它会接收消息 M1 到 M7 还是仅接收在时间 T8 之后发送到主题的消息。

场景 2:

JMS 代理正在运行,L 已连接并侦听 jmsTopic。 P 将 M1 发送到 M4。 L接收M1至M4。在L处理M1到M4的同时,P发送M5到M7,但是L在处理M4期间崩溃了。如果 L 再次将自身连接到 jmsTopic,它是否会收到 M5 到 M7,或者只有 L 连接到 jmsTopic 之后发送的消息才会被 L 接收。

场景 3:

JMS 代理正在运行,L 已连接并侦听 jmsTopic,P 发送 M1至 M7。然而经纪人崩溃了; L 了解代理状态并在 AMQ 启动并运行后重新连接。

I am not sure what happens in the below scenarios, it would be of great help if someone explains it.

Producer (P) sends messages M1, M2 , M3 , M4 , M5, M6 , M7; assuming it is sent from time T1 to T7.

Message Consumer (L) will be a listener bound to the topic.
Topic Name : jmsTopic

Scenario 1:

JMS broker is running, L is not connected to jmsTopic. P sends M1 to M7 to jmsTopic. If L is connected to jmsTopic at time say T8 which is greater than T7, will it receive the messages M1 to M7 or only messages that are sent to the topic after time T8.

Scenario 2:

JMS broker is running, L is connected and listening to jmsTopic. P sends M1 to M4. L receives M1 to M4. In the meantime L processes M1 to M4, P sends M5 to M7, however L crashes out during processing of M4. If L again connects itself to jmsTopic does it receive M5 to M7 or only messages that were sent after L has connected to jmsTopic will be received by L.

Scenario 3:

JMS broker is running, L is connected and listening to jmsTopic, P sends M1 to M7. However the broker crashes; is L aware of broker status and reconnects once AMQ is up and running.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鲸落 2024-11-14 18:34:58

场景 1:AMQ 正在运行,L 未运行
连接到 AMQ 中的 jmsTopic。 P 发送
M1 到 M7 到 jmsTopic。如果 L 是
连接到 jmsTopic 的时间为 T8
比T7还大吧
接收消息 M1 至 M7 或仅
发送到主题的消息
时间 T8 之后。

队列的全部目的是保证交付。在侦听器将消息从队列中取出之前,不会处理任何消息,因此在 T8 之前到达的所有消息都会在那里。

场景2:AMQ正在运行,L为
已连接并正在监听 jmsTopic, P
将 M1 发送到 M4。 L接收M1至M4。
同时L处理M1到M4,
P 发送 M5 到 M7,但是 L 崩溃
在处理 M4 期间输出。如果L
再次将自身连接到 jmsTopic ,
它接收 M5 至 M7 还是仅接收
L 之后发送的消息
连接到jmsTopic将会收到
作者:L.

#1 相同:所有消息 M5 及更新的消息都将由侦听器接收。

场景3:AMQ正在运行,L为
已连接并正在监听 jmsTopic, P
将 M1 发送到 M7。然而AMQ崩溃了;
L 是否了解 AMQ 状态并且
AMQ 启动并运行后重新连接。

设置AMQ以保证交付;所有消息都将被序列化,以保证收到后送达。

Scenario 1: AMQ is running, L is not
connected to jmsTopic in AMQ. P sends
M1 to M7 to jmsTopic. If L is
connected to jmsTopic at time say T8
which is greater than T7, will it
receive the messages M1 to M7 or only
messages that are sent to the topic
after time T8.

The whole point of the queue is to guarantee delivery. No messages are processed until a listener takes them off the queue, so all messages that arrive before T8 will be there.

Scenario 2: AMQ is running, L is
connected and listening to jmsTopic, P
sends M1 to M4. L receives M1 to M4.
In the meantime L processes M1 to M4,
P sends M5 to M7, however L crashes
out during processing of M4. If L
again connects itself to jmsTopic ,
does it receive M5 to M7 or only
messages that were sent after L has
connected to jmsTopic will be received
by L.

Same as #1: all messages M5 and newer will be received by the listener.

Scenario 3: AMQ is running, L is
connected and listening to jmsTopic, P
sends M1 to M7. However AMQ crashes;
is L aware of AMQ status and
reconnects once AMQ is up and running.

Set up AMQ for guaranteed delivery; all messages will be serialized to guarantee delivery on receipt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文