如何在activemq.xml中创建/预配置持久订阅者,以便在ActiveMQ启动时准备好这些订阅? [英] How to create/preconfigure durable subscriber(s) in activemq.xml so that these subscriptions are ready upon ActiveMQ starts up?

查看:138
本文介绍了如何在activemq.xml中创建/预配置持久订阅者,以便在ActiveMQ启动时准备好这些订阅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在activemq.xml中创建/预配置持久性订阅者,以便在ActiveMQ出现时就可以准备好这些订阅?好像订阅者处于离线状态一样.

How to create/preconfigure durable subscriber(s) in activemq.xml so that these subscriptions are ready upon ActiveMQ comes up? As if subscribers are in the offline state.

我们期望有固定数量(但仍可配置)的已知订户. 要缓冲发布者从第一天开始发送的所有消息,以防并非所有订阅者都收到 起来了.不知道这是否是常见的情况,但请先感谢您的帮助.

We're expecting a fixed (yet configurable) number of known subscribers. Wanna buffer all msgs sent by the publisher starting day 1, in case not all subscribers are up. Not sure if this is a common scenario but thanks in advance for the help.

推荐答案

这是一个非常常见的用例.您实际上应该查看的是复合目标,而不是持久性主题(有很多此功能存在的问题,主要是默认情况下不保留消息,因此无法在代理中断后幸存下来).

This is a really common use case. What you should actually be looking at is composite destinations, rather than durable topics (there are loads of problems with this functionality, the main one being messages not being persisted by default and therefore not surviving broker outages).

使用此方案,您可以设置一个复合主题,以将每条消息转发到多个队列-每个订阅者专用一个队列.

Using this scheme you set up a composite topic to forward each message to a number of queues - a dedicated one per subscriber.

<destinationInterceptors>
  <virtualDestinationInterceptor>
    <virtualDestinations>
      <compositeTopic name="orders">
        <forwardTo>
          <queue physicalName="orders.consumer1" />
          <queue physicalName="orders.consumer2" />
        </forwardTo>
      </compositeTopic>
    </virtualDestinations>
  </virtualDestinationInterceptor>
</destinationInterceptors>

这样,当您的订户最终连接到自己的队列时,它会耗尽输入到该队列中的消息.

This way when your subscriber eventually connects to its own queue, it drains the messages that were fed into it.

请注意,请确保您的内存限制足够大来处理存储在这些队列中的消息,否则您的代理将似乎挂起(一种称为生产者流控制的代理功能).

A word of caution, make sure that your memory limits are large enough to deal with the messages stored in these queues, or your broker will appear to hang (a broker function called producer flow control).

我看到您是新用户,因此,如果这回答了您的问题,请勾选它.

I see that you are a new user, so if this answers your question, please tick it.

这篇关于如何在activemq.xml中创建/预配置持久订阅者,以便在ActiveMQ启动时准备好这些订阅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆