问题描述
- hornetq 消息阻塞的问题=
-
使用hornetq队列的时候,总是会出现阻塞的情况,
我是使用线程池起了15个线程,每秒种进行拿取一次,但是在进行一段时间后总是会多出来一个消费者
然后就不能拿取到消息了,求大神指导
解决方案
源代码。。。。。。。。。。。。。。。。
解决方案二:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<!--
192.168.0.215
11212
255.255.255.0
9876
2000
-->
HornetQ.main.config
<bindings-directory>F:/hornetq/data/messaging/bindings</bindings-directory>
<large-messages-directory>F:/hornetq/data/messaging/largemessages</large-messages-directory>
<paging-directory>F:/hornetq/data/messaging/paging</paging-directory>
<!--离线消息固化到文件-->
<journal-directory>F:/hornetq/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<!-- 缓存大小 -->
<id-cache-size>9000</id-cache-size>
<jmx-management-enabled>true</jmx-management-enabled>
<!-- 消息计数器 -->
<message-counter-enabled>true</message-counter-enabled>
<!-- keep history for a week -->
<message-counter-max-day-history>7</message-counter-max-day-history>
<!-- sample the queues every minute (60000ms) -->
<message-counter-sample-period>60000</message-counter-sample-period>
<persistence-enabled>true</persistence-enabled>
<!-- 通知将从JMS话题 "notificationsTopic"上接收
<management-notification-address>jms.queue.notificationsQueue</management-notification-address>
-->
<!--不配置这个的话会有一个安全警告-->
HORNETQ.CLUSTER.ADMIN.USER
test65525
<!-- Connectors -->
<connectors>
<connector name="connector-netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="use-nio" value="true" />
<param key="host" value="localhost"/>
<param key="port" value="11212" />
</connector>
<!-- SSL connector -->
<connector name="netty-ssl-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="localhost"/>
<param key="port" value="5500"/>
<param key="ssl-enabled" value="true"/>
<param key="key-store-path" value="F:/ssl/keystore"/>
<param key="key-store-password" value="test"/>
</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
</factory-class>
<!-- -->
<param key="use-nio" value="true" />
<param key="host" value="0.0.0.0,127.0.0.1,localhost"></param>
<param key="port" value="11212" />
</acceptor>
<!-- SSL connector -->
<acceptor name="netty-ssl-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="localhost"/>
<param key="port" value="5500"/>
<param key="ssl-enabled" value="true"/>
<param key="key-store-path" value="F:/ssl/keystore"/>
<param key="key-store-password" value="test"/>
<param key="trust-store-path" value="F:/ssl/truststore"/>
<param key="trust-store-password" value="test"/>
</acceptor>
</acceptors>
<!-- Other config -->
<address-settings>
<address-setting match="jms.queue.#">
<redelivery-delay>5000</redelivery-delay>
<!-- 没有导致远程queue查找不到 -->
<expiry-address>jms.queue.expiryQueue</expiry-address>
<!-- 没有导致远程queue查找不到 -->
<last-value-queue>true</last-value-queue>
<max-size-bytes>100000</max-size-bytes>
<page-size-bytes>20000</page-size-bytes>
<redistribution-delay>0</redistribution-delay>
<address-full-policy>PAGE</address-full-policy>
<!-- 死信地址-->
<send-to-dla-on-no-route>true</send-to-dla-on-no-route>
<dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
<max-delivery-attempts>3</max-delivery-attempts>
</address-setting>
</address-settings>
<security-settings>
<!--security for example queue-->
<security-setting match="jms.queue.#">
<permission type="createDurableQueue" roles="guest" />
<permission type="deleteDurableQueue" roles="guest" />
<permission type="createNonDurableQueue" roles="guest" />
<permission type="deleteNonDurableQueue" roles="guest" />
<permission type="consume" roles="guest" />
<permission type="send" roles="guest" />
</security-setting>
</security-settings>
时间: 2024-10-25 20:32:14