0

我正在尝试在 ActiveMQ 启动时设置一个主题。我们将拥有 Durable 订阅者,但它们尚不可用。

启动配置说要添加:

<destinations>
  <queue physicalName="FOO.BAR" />
  <topic physicalName="SOME.TOPIC" />
</destinations>

我已将此添加到 activemq.xml 但没有运气。ActiveMQ 启动时没有创建主题。我们正在运行 5.7。

想法?

编辑:

我正在尝试设置有关 ActiveMQ 启动的主题。当 ActiveMQ 重新启​​动(或关闭并启动)时,主题被删除,因为它们在内存中。我想在 XML 配置中添加一个主题,以便在启动 AMQ 时动态创建它。这样我们的 ESB 就可以直接访问它并开始工作了。ESB 将成为 Durable 订阅者,但目前还不是。仍在执行。文档说要添加到 XML 配置中的上述行。但我没有运气。开始时不会创建主题。

所以我的我会在任何地方添加它们?

  <beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd
 http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <value>file:${activemq.conf}/credentials.properties</value>
    </property>
</bean>

<!--
    The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">

    <!-- Like here? -->
    <destinations>
       <queue physicalName="FOO.BAR" />
       <topic physicalName="SOME.TOPIC" />
    </destinations>
    <!--
        For better performances use VM cursor and small memory limit.
        For more information, see:

        http://activemq.apache.org/message-cursors.html

        Also, if your producer is "hanging", it's probably due to producer flow control.
        For more information, see:
        http://activemq.apache.org/producer-flow-control.html
    -->

    <destinationPolicy>
        <policyMap>
          <policyEntries>
            <policyEntry topic=">" producerFlowControl="true">
                <!-- The constantPendingMessageLimitStrategy is used to prevent
                     slow topic consumers to block producers and affect other consumers
                     by limiting the number of messages that are retained
                     For more information, see:

                     http://activemq.apache.org/slow-consumer-handling.html

                -->
              <pendingMessageLimitStrategy>
                <constantPendingMessageLimitStrategy limit="1000"/>
              </pendingMessageLimitStrategy>
            </policyEntry>
            <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
              <!-- Use VM cursor for better latency
                   For more information, see:

                   http://activemq.apache.org/message-cursors.html

              <pendingQueuePolicy>
                <vmQueueCursor/>
              </pendingQueuePolicy>
              -->
            </policyEntry>
          </policyEntries>
        </policyMap>
    </destinationPolicy>


    <!--
        The managementContext is used to configure how ActiveMQ is exposed in
        JMX. By default, ActiveMQ uses the MBean server that is started by
        the JVM. For more information, see:

        http://activemq.apache.org/jmx.html
    -->
    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>

    <!--
        Configure message persistence for the broker. The default persistence
        mechanism is the KahaDB store (identified by the kahaDB tag).
        For more information, see:

        http://activemq.apache.org/persistence.html
    -->
    <persistenceAdapter>
        <kahaDB directory="${activemq.data}/kahadb"/>
    </persistenceAdapter>


      <!--
        The systemUsage controls the maximum amount of space the broker will
        use before slowing down producers. For more information, see:
        http://activemq.apache.org/producer-flow-control.html
        If using ActiveMQ embedded - the following limits could safely be used:

    <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage limit="20 mb"/>
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="1 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="100 mb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>
    -->
      <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage limit="64 mb"/>
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="100 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="50 gb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>

    <!--
        The transport connectors expose ActiveMQ over a given protocol to
        clients and other brokers. For more information, see:

        http://activemq.apache.org/configuring-transports.html
    -->
    <transportConnectors>
        <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
        <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
    </transportConnectors>

    <!-- destroy the spring context on shutdown to stop jetty -->
    <shutdownHooks>
        <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
    </shutdownHooks>

</broker>

<!--
    Enable web consoles, REST and Ajax APIs and demos

    Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>

/齐吉

4

3 回答 3

0

将您的目的地放在<destinations>标签内,例如

<destinations>
   <queue physicalName="FOO.BAR" />
   <topic physicalName="SOME.TOPIC" />
</destinations>

里面

<broker></broker>标签。

于 2014-02-27T06:21:15.400 回答
0

我刚刚将它们放入香草 5.7 AMQ 安装(在 MacOS 上),我通过 Web 控制台看到了队列和主题......

您应该重新安装 AMQ 以尝试缩小问题范围

于 2013-02-20T01:51:45.863 回答
0

我自己的解决方案有效。尽管在我们的 Linux 环境中,我们有不止一个实例。/user/share 下一个,/home/activemq/ 下一个

所以当我编辑正确的文件时它起作用了。

感谢你付出的努力。

于 2013-02-20T08:05:08.313 回答