JBoss HornetQ:为慢速消费者设置消费者窗口大小

时间:2011-08-11 06:03:13

标签: java jboss6.x hornetq

我想将<consumer-window-size/>设置为0。这似乎是另一个问题(JMS queue with multiple consumers)的答案,并在第17.1.1章的article中进行了描述。我使用JNDI检索连接工厂。我的hornetq-jms.xml看起来像这样:

<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

  <connection-factory name="ConnectionFactory">
    <connectors>
      <connector-ref connector-name="netty-connector"/>
    </connectors>
    <entries>
      <entry name="ConnectionFactory"/>       
    </entries>
    <consumer-window-size>0</consumer-window-size>
  </connection-factory>

  <queue name="my.qeue">  
    <entry name="/queue/test"/>  
  </queue>   
</configuration>

<connection-factory/>部分是从上面的链接复制并粘贴的,但我收到错误:

DEPLOYMENTS IN ERROR:
Deployment "org.hornetq:module=JMS,name="ConnectionFactory",
  type=ConnectionFactory" is in error due to the following reason(s):
  HornetQException[errorCode=104 message=There is no connector with
  name 'netty-connector' deployed.]

这可能与JBoss-6相关,因为在其他环境中这似乎有效:force order of messages with HornetQ

1 个答案:

答案 0 :(得分:10)

在放置netty-connector之前,您需要查看已在hornetq-configuration.xml中注册的连接器

从你的hornetq配置中,你会看到类似的东西:

<connectors>
        <connector name="netty">
                <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                <param key="host" value="${jboss.bind.address:localhost}" />
                <param key="port" value="${hornetq.remoting.netty.port:5445}" />
        </connector>

        <connector name="in-vm">
                <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                <param key="server-id" value="${hornetq.server-id:0}" />
        </connector>

</connectors>

您将在连接工厂定义中匹配连接器。

有关更多信息,请阅读HornetQ关于接受器和连接器的文档。