【问题标题】:setting max-size-bytes and address-full-policy in HornetQClient在 HornetQClient 中设置 max-size-bytes 和 address-full-policy
【发布时间】:2013-03-30 09:39:28
【问题描述】:

我们使用 HornetQ 核心 API 来从 HornetQClient 创建 ServerLocator。 ServerLocator 用于创建队列。 这是代码:

TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());

ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(connectorConfig);

int ackBatchSize = ConfigWrapperHelper.getIntParameter(ProductMarkingConfigParamEnum.ACK_BATCH_SIZE_FOR_JMS_QUEUES);
locator.setAckBatchSize(ackBatchSize);
locator.setConsumerWindowSize(CONSUMER_WINDOW_SIZE);
locator.setClientFailureCheckPeriod(Long.MAX_VALUE);
locator.setConnectionTTL(-1);

ClientSessionFactory  clientSessionFactory = locator.createSessionFactory(connectorConfig);

ClientSession clientSession = _clientSessionFactory.createSession(XA, AUTO_COMMIT_SENDS, AUTO_COMMIT_ACKS);
clientSession.createQueue(queueName, queueName, IS_DURABLE);

问题是我们需要为每个队列配置 max-size-bytes 和 te address-full-policy。

我知道如何通过 XML 中的

我看到有一个名为 AddressSettings 的类,可以在其中设置这些参数。

我的问题是 - 如何将此 AddressSettings 对象配置到 ServerLocator 中?

或者 - 是否有其他方法可以在从 HornetQCLient 创建的 ServerLocator 中配置这些参数?

【问题讨论】:

    标签: queue jms hornetq


    【解决方案1】:

    AddressSettings 是服务器的属性,您不能从客户端设置它。您可以在 HornetQServer 上使用它,或者更改等效的 XML。

    AddressSettings 基于通配符。因此,您可以创建一个地址设置,以根据您的规则匹配您的队列名称。

    如果你使用的是嵌入式服务器,你可以使用这个:

    server.getAddressSettingsRepository().addMatch("<your-expression-matchin your queue(s)", setting);
    

    要使用 XML 进行配置,请查看文档的这一部分:

    http://docs.jboss.org/hornetq/2.2.14.Final/user-manual/en/html/queue-attributes.html#queue-attributes.address-settings

    在 JBoss 7 上,相同的 XML sn-p 可以在standalone-all.xml(或任何包含 hornetq / 消息传递的独立 *.xml)中找到

    【讨论】:

    • 我明白,因为我使用的是 HornetQCLient,所以我不能使用 AddressSettings。但目前我没有使用任何 XML 来配置 HornetQClient。我怎样才能添加这样的 XML?这个 XML 应该在哪里?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-20
    • 2022-12-09
    • 1970-01-01
    • 2020-05-23
    • 1970-01-01
    相关资源
    最近更新 更多