配置虚拟主题

时间:2018-04-21 19:11:59

标签: activemq

我想尝试一个虚拟主题工作的简单示例,但我失败了。

据我所知,activemq网站上的文档可能不正确。

我的C#如下:

I have a consumer connect to queue://Consumer.A.VirtualTopic.FOO
I have a producer connect to topic://VirtualTopic.FOO
The producer publishes a message

我的服务器配置如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">

  <notes>
    The default configuration with tls/ssl enabled.
  </notes>

  <log_category console="console" security="security" connection="connection" audit="audit"/>


  <authentication domain="apollo"/>
  <!-- Give admins full access -->
  <access_rule allow="admins" action="*"/>
  <access_rule allow="*" action="connect" kind="connector"/>


  <virtual_host id="mybroker">
    <!--
      You should add all the host names that this virtual host is known as
      to properly support the STOMP 1.1 virtual host feature.
      -->
    <host_name>mybroker</host_name>
    <host_name>localhost</host_name>
    <host_name>127.0.0.1</host_name>

    <!-- Uncomment to disable security for the virtual host -->
    <!-- <authentication enabled="false"/> -->

    <!-- Uncomment to disable security for the virtual host -->
    <!-- <authentication enabled="false"/> -->
    <access_rule allow="users" action="connect create destroy send receive consume"/>


    <!-- You can delete this element if you want to disable persistence for this virtual host -->
    <leveldb_store directory="${apollo.base}/data"/>


  </virtual_host>

  <web_admin bind="http://127.0.0.1:61680"/>
  <web_admin bind="https://127.0.0.1:61681"/>

  <connector id="tcp" bind="tcp://0.0.0.0:61613" connection_limit="2000"/>
  <connector id="tls" bind="tls://0.0.0.0:61614" connection_limit="2000"/>
  <connector id="ws"  bind="ws://0.0.0.0:61623"  connection_limit="2000"/>
  <connector id="wss" bind="wss://0.0.0.0:61624" connection_limit="2000"/>

  <key_storage file="${apollo.base}/etc/keystore" password="password" key_password="password"/>

    <destinationInterceptors>
      <virtualDestinationInterceptor>
        <virtualDestinations>
        <virtualTopic name="VirtualTopic.>" prefix="Consumer.*."/> 
        </virtualDestinations>
      </virtualDestinationInterceptor>
    </destinationInterceptors>  

</broker>

非常感谢任何帮助

1 个答案:

答案 0 :(得分:0)

我犯了一个错误。我使用的activemq apollo与activemq不同。配置不同但服务器不会抱怨,如果你给它伪造配置。这里记录了apollo配置:https://activemq.apache.org/apollo/documentation/user-manual.html。我需要在元素中添加一个mirrored选项设置为true的元素。