繁体   English   中英

为JMS发布者/使用者设置clientID的目的是什么?

[英]What's the Purpose of setting the clientID for JMS publisher / consumer?

我了解为持久主题编写jms主题订阅者时,需要设置clientId和订阅名称。

但是在发布主题时设置clientID的目的是什么? 我见过有人甚至为发布者/使用者设置客户端ID,但是没有人解释为什么需要它。

ConnectionFactory conFactory =  this.getConnectionFactory();
Connection connection = conFactory.createConnection();

connection.setClientID("WHATS_MY_PURPOSE"); // Why do we need clientID while publishing the TOPIC from consumer / publisher

connection.start();
MessageProducer producer = session.createProducer(destination);

需要clientId来唯一标识应用程序。 在发布/订阅消息传递模式中使用持久订阅时,这是必须的。 如您所知,消息传递提供者在脱机时会缓存发往持久订阅者应用程序的发布。 当此类应用程序再次上线时,消息传递提供者必须确定OK, this is the same application that created a durable subscription but went away for reason. Now it has come back. So let me deliver all messages that were published when this application was away OK, this is the same application that created a durable subscription but went away for reason. Now it has come back. So let me deliver all messages that were published when this application was away OK, this is the same application that created a durable subscription but went away for reason. Now it has come back. So let me deliver all messages that were published when this application was away 为了验证它是同一应用程序,消息传递提供程序将应用程序的clientId与具有已缓存的订阅信息的可用clientId进行比较。

暂无
暂无

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

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