3.2. 接受者如何配置

您可以使用 BROKER_INSTANCE_DIR/etc/broker.xml 配置文件配置接收器来接受代理实例的传入客户端连接。

broker.xml 配置文件在 <acceptors> 部分包含以下默认接收器:

<configuration>
...
  <core>
  ...
     <acceptors>
       <!-- Acceptor for every supported protocol -->
       <acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor> 1

       <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
       <acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpMinCredits=300</acceptor>

       <!-- STOMP Acceptor. -->
       <acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true</acceptor>

       <!-- HornetQ Compatibility Acceptor.  Enables HornetQ Core and STOMP for legacy HornetQ clients. -->
       <acceptor name="hornetq">tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP;useEpoll=true</acceptor>

       <!-- MQTT Acceptor -->
       <acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true</acceptor>
       ...
  </core>
</configuration>
1
默认接收器,接受任何受支持的消息传递协议的传入客户端连接。

要为代理实例配置传入客户端连接,您可以修改任何默认接收器的配置属性,也可以添加新的接收器。本例演示了一个新的接收器配置为使用 OpenWire 协议接受 TCP 连接:

<acceptor name="my-acceptor">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=OPENWIRE;useEpoll=true</acceptor>

相关信息