问题描述
我使用spring与activemq整合发送消息,发送速度可以达到10000/s,但是消费者的消费速度却是非常慢,求给位大神帮忙!!!这是我配置文件的内容:<beanid="innerNgbfJmsFactory"class="org.apache.activemq.ActiveMQConnectionFactory"><!--<propertyname="brokerURL"value="failover:(tcp://10.253.45.103:61616)"/>--><propertyname="brokerURL"value="${ngbf.jms.provider.url}"/><!--慢消费者设置为true,快消费者设置为false--><propertyname="dispatchAsync"value="true"/><!--<propertyname="producerWindowSize"value="10240000"/><propertyname="useAsyncSend"value="true"/>--></bean><!--设置发送连接池,提高性能--><beanid="ngbfJmsSenderFactory"class="org.apache.activemq.pool.PooledConnectionFactory"destroy-method="stop"><propertyname="connectionFactory"ref="innerNgbfJmsFactory"/><!--<propertyname="maxConnections"value="100"></property><propertyname="maximumActive"value="100"></property><propertyname="exclusiveConsumer"value="true"></property>--></bean><!--设置接收连接池,和发送区分以提高性能--><beanid="ngbfJmsReveiverFactory"class="org.apache.activemq.pool.PooledConnectionFactory"destroy-method="stop"><propertyname="connectionFactory"ref="innerNgbfJmsFactory"/><!--<propertyname="sessionCache"value="10"></property>--><!--<propertyname="maxConnections"value="100"></property><propertyname="maximumActive"value="100"></property>--></bean><!--发送模板--><beanid="ngbfJmsTemplate"class="org.springframework.jms.core.JmsTemplate"><propertyname="connectionFactory"ref="ngbfJmsSenderFactory"/><propertyname="messageConverter"ref="ngbfMessageByteConvert"/><!--<propertyname="defaultDestination"ref="destination"/>--></bean><!--消息转换器--><beanid="ngbfMessageConvert"class="com.kingstar.ngbf.s.jms.MessageUnitConvert"/><beanid="ngbfMessageTextConvert"class="com.kingstar.ngbf.s.jms.MessageUnitTextConvert"/><beanid="ngbfMessageByteConvert"class="com.kingstar.ngbf.s.jms.MessageUnitByteConvert"/><!--缺省的消息监听适配器--><beanid="ngbfDefaultMessageListenerAdapter"class="org.springframework.jms.listener.adapter.MessageListenerAdapter"abstract="true"><propertyname="defaultListenerMethod"value="handleMessage"/><!--handleMessage&receive--><propertyname="messageConverter"ref="ngbfMessageByteConvert"/></bean><!--定义destination--><!--<beanid="destination"class="org.apache.activemq.command.ActiveMQQueue"><constructor-argindex="0"><value>NGBF.Queue?consumer.exclusive=true&consumer.priority=10</value></constructor-arg></bean>--><!--定义缺省的Queue消息监听器--><beanid="ngbfDefaultQueueMessageListener"parent="ngbfDefaultMessageListenerAdapter"><constructor-arg><beanclass="com.kingstar.ngbf.s.jms.MessageUnitQueueListener"/></constructor-arg></bean><!--<beanid="ngbfDefaultQueueMessgeListener1"class="org.springframework.jms.listener.adapter.MessageListenerAdapter"><constructor-arg><beanclass="com.kingstar.ngbf.s.jms.MessageUnitQueueListener1"/></constructor-arg><propertyname="defaultListenerMethod"value="handleMessage"/><propertyname="messageConverter"ref="ngbfMessageByteConvert"/></bean>--><!--定义缺省的Topic消息监听器--><beanid="ngbfDefaultTopicMessageListener"parent="ngbfDefaultMessageListenerAdapter"><constructor-arg><beanclass="com.kingstar.ngbf.s.jms.MessageUnitTopicListener"/></constructor-arg></bean><beanid="taskExecutor"class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><propertyname="corePoolSize"value="10"/><propertyname="maxPoolSize"value="100"/><propertyname="queueCapacity"value="1000"/><propertyname="keepAliveSeconds"value="300"/></bean><!--缺省的消息监听器Queue容器,可以被子类集成改写--><beanid="ngbfDefaultQueueListenerContainer"class="org.springframework.jms.listener.DefaultMessageListenerContainer"lazy-init="false"><propertyname="connectionFactory"ref="ngbfJmsReveiverFactory"/><propertyname="destinationName"value="NGBF.Queue"/><propertyname="pubSubDomain"value="false"/><!--事务值为false,接受速度明显提高--><!--<propertyname="sessionTransacted"value="false"/>--><propertyname="messageListener"ref="ngbfDefaultQueueMessageListener"/><!--多线程监听?--><!--maxMessagesPerTask值小于-1,循环接收消息--><propertyname="maxMessagesPerTask"value="-1"/><propertyname="concurrentConsumers"value="10"/><propertyname="maxConcurrentConsumers"value="100"/><propertyname="idleTaskExecutionLimit"value="2"/><propertyname="receiveTimeout"value="10000"/><propertyname="cacheLevel"value="3"/><propertyname="taskExecutor"ref="taskExecutor"/></bean><beanid="ngbfDefaultQueueListener"parent="ngbfDefaultQueueListenerContainer"><propertyname="messageSelector"value="${ngbf.jms.queue.selector}"/><!--<propertyname="destinationName"value="${ngbf.jms.queue.default}"/>--><propertyname="destinationName"value="NGBF.Queue"/></bean>
解决方案
解决方案二:
各位大神帮个忙啊!!!!
解决方案三:
别沉下去啊!
解决方案四:
帮顶,最近我也在用activemq,只能算是刚入门的级别,只要有钱出钱,有力出力了
解决方案五:
只能有钱出钱有力出力了