简体   繁体   English

让消息队列订阅主题

[英]Have a message queue subscribe to a topic

I have a Topic that has two subscribers. 我有一个有两个订阅者的主题。 However, one of the subscribers will be deployed in a cluster. 但是,其中一个订户将部署在群集中。 So, in effect (I think?) the cluster will be seen as multiple subscribers. 因此,实际上(我认为?),群集将被视为多个订户。 I need to make sure only one message is consumed by the cluster. 我需要确保集群仅消耗一条消息。

I do not know the options to do this. 我不知道执行此操作的选项。 Is it possible to insert a queue in between the cluster and the topic, and then have the clustered application only work with the inserted queue? 是否可以在集群和主题之间插入一个队列,然后让集群应用程序仅对插入的队列起作用?

If this is possible, how, in general, to make the queue "subscribe" to the Topic? 如果有可能,通常如何使队列“订阅”该主题?

Another idea I heard is to make cloned subscribers in the cluster, anyone hear of this before to solve this issue? 我听到的另一个想法是在集群中创建克隆的订户,有人在解决此问题之前听说过吗?

Another idea is to do away with the Topic and just use two queues in its place, this seems to be a safe solution? 另一个想法是取消主题,仅在其位置使用两个队列,这似乎是一个安全的解决方案?

Using WebSphere MQ 使用WebSphere MQ

You can use a durable subscription to achieve this. 您可以使用持久订阅来实现此目的。

Administratively create a durable subscription and specify a destination, basically a queue, which will receive the publications that are published on the specified topic. 通过管理方式创建持久预订,并指定目的地(基本上是队列),该目的地将接收在指定主题上发布的发布。 Your clustered application can then get messages from that destination. 然后,您的群集应用程序可以从该目标获取消息。 Since the publications are being received from a queue, only one instance of your application will get message(s). 由于从队列中接收发布,因此只有应用程序的一个实例将获得消息。

The command below creates durable subscription for topic "/SPORTS/HOCKEY" with destination queue as Q1. 下面的命令为主题“ / SPORTS / HOCKEY”创建持久订阅,目标队列为Q1。

DEFINE SUB(SPORTSUB) TOPICSTR(/SPORTS/HOCKEY) TOPICOBJ(SPORT) DESTQ(Q1)

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

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