简体   繁体   English

一旦客户端确认消息在 JMS 主题上的可用性?

[英]Message availability on JMS Topic once client acknowledges it?

I have a simple scenario, where publisher(my java application) publish the message on topic.我有一个简单的场景,发布者(我的 Java 应用程序)发布关于主题的消息。 50 clients have subscribed on same JMS topic.As soon as message is published on topic, all the 50 subscriber will be notified .Say only one subscriber(0ut 0f 50) process the message and send the acknowledgement after processing.(Once this client processing is done, i can see the message as consumed on apache MQ console. Otherwise if no client sends the acknowledgment after receiving the message i see the message as pending message). 50 个客户端订阅了同一个 JMS 主题。一旦在主题上发布消息,将通知所有 50 个订阅者。假设只有一个订阅者(0ut 0f 50)处理消息并在处理后发送确认。(一旦此客户端处理完成后,我可以在 apache MQ 控制台上看到已使用的消息。否则,如果没有客户端在收到消息后发送确认,我会将消息视为待处理消息)。

Now question is once any client sends the acknowledgment and any new client subscribe on topic, will he be notified about the message ?现在的问题是,一旦任何客户端发送确认并且任何新客户端订阅主题,他会收到有关消息的通知吗? or it works in a way where message has been consumed by any of the client (which internally means acknowledgment has been sent by any of the client), no further notification will be sent to any new subscriber and message will be taken off from the Topic(This is the behaviuor i am experiencing but looks like it should not work in this fashion as per as per Publish/subscribe model under http://en.wikipedia.org/wiki/Java_Message_Service )?或者它以任何客户端使用消息的方式工作(这在内部意味着任何客户端已发送确认),不会向任何新订阅者发送进一步的通知,并且消息将从主题中删除(这是我遇到的行为,但看起来它不应该按照http://en.wikipedia.org/wiki/Java_Message_Service下的发布/订阅模型以这种方式工作)?

I have not worked with Apache MQ.我没有使用过 Apache MQ。 But in general:但总的来说:

In a Publish/Subscribe model, when a message is published, all subscribers will receive that publication.在发布/订阅模型中,当发布消息时,所有订阅者都将收到该发布。

Acknowledgement by subscribers is only to messaging providers and not to the publisher.订阅者的确认仅适用于消息传递提供者而不是发布者。 When a subscriber acknowledges the receipt of a message, that message is removed by the messaging provider so that the message is not delivered again.当订阅者确认收到消息时,消息提供者将删除该消息,以便不再传递该消息。

If a new subscriber comes in after a message is published on a topic, then the subscriber will not get that publication.如果在主题上发布消息后有新订阅者加入,则订阅者将不会获得该发布。 Any new publication on the topic will be received by the subscriber.订阅者将收到有关该主题的任何新出版物。 Some providers like IBM WebSphere MQ have a feature called "Retain Publication" wherein a copy of a publication is cached.某些供应商(如 IBM WebSphere MQ)具有称为“保留发布”的功能,其中缓存发布的副本。 Any new subscribers who come in after a publication is made will receive this cached publication.发布后加入的任何新订阅者都将收到此缓存发布。 Retain publication feature is useful when there is a time delay between publications on a topic, new subscribers will get the cached publication immediately rather than waiting for a new publication to be made by publisher.当主题的发布之间存在时间延迟时,保留发布功能很有用,新订阅者将立即获得缓存的发布,而不是等待发布者进行新发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM