activemq

activeMQ学习(二、与springboot集成)

人盡茶涼 提交于 2019-12-01 11:50:38
POOM文件 首先导入activemq所需的jar包 <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-activemq</artifactId> </dependency> </dependencies> 生产者 application.yml server: port: 8090 servlet: context-path: /activemqProducer spring: activemq: broker-url: tcp://127.0.0.1:61616 user: 123 password: 123

ActiveMQ redelivery does not work

被刻印的时光 ゝ 提交于 2019-12-01 11:32:12
问题 I am trying the implement a dead letter queue using ActiveMQ. Unfortunately the documentation on this end is rather vague on some aspects and I can't seem to get everything properly set up. I have the following Beans configured: @Bean public JmsTemplate createJMSTemplate() { logger.info("createJMSTemplate"); JmsTemplate jmsTemplate = new JmsTemplate(getActiveMQConnectionFactory()); jmsTemplate.setDefaultDestinationName(queue); jmsTemplate.setDeliveryPersistent(true); jmsTemplate

你应该知道的那些超时设置或默认参数

一个人想着一个人 提交于 2019-12-01 11:14:27
郑昀 总结 最后 更新于 2013年6月19日 存储介质 Redis Java-Driver Jedis 连接池:Jedis的连接池设计基于 Apache Commons-Pool 原生库: maxActive :可用连接实例的最大数目,默认值为8; maxIdle:空闲连接实例的最大数目,默认值也是8; minIdle:空闲连接实例的最小数目,默认值为0; maxWait :等待可用连接的最大数目,单位毫秒,默认值为-1,表示永不超时。 mongodb Server端的连接数 maxConns :mongodb 实例的最大连接数限制可以通过启动参数中的 maxConns 设置。默认值取决于系统的限制(如 ulimit 和 file descriptor)。如果没设置这个参数, mongodb 自己不会限制连接数。但,你不能设置超过 20,000 。 client端的连接 Java-Driver MongoOptions.maxWaitTime:连接上阻塞线程的最大等待时间,默认值120秒; MongoOptions.connectTimeout:建立新连接超时时间( 郑昀 注: Only used for new connections), 默认无限制; MongoOptions.socketTimeout:socket通讯超时时间,默认无限制; MongoOptions.

Get list of queue names in ActiveMQ

感情迁移 提交于 2019-12-01 11:04:45
问题 I have tried below code to get list of queues in ActiveMQ. But its not working. I have 4 queues in my ActiveMQ. try { ActiveMQConnection.makeConnection(URL).start(); Set<ActiveMQQueue> allque= ActiveMQConnection.makeConnection().getDestinationSource().getQueues(); Iterator<ActiveMQQueue> itr= allque.iterator(); while(itr.hasNext()){ ActiveMQQueue q= itr.next(); System.out.println(q.getQueueName()); } } catch (Exception e) { e.printStackTrace(); } Please let me know any correction in my code

ActiveMQ学习第八篇:Messaage

自闭症网瘾萝莉.ら 提交于 2019-12-01 07:16:32
Messaage Properties:   ActiveMQ支持很多消息属性,具体可以参考 http://activemq.apache.org/activemq-message-properties.html    常见得一些属性说明: queue得消息默认是持久化得 消息得优先级默认是4. 消息发送时设置了时间戳。 消息的过期时间默认是永不过期,过期的消息进入DLQ,可以配置DLQ及其处理策略。 如果消息是重发的,将会被标记出来。 JMSReplyTo标识响应消息发送到哪个queue. JMSCorelationID标识此消息相关联的消息id,可以用这个标识把多个消息连接起来。 JMS同时也记录了消息重发的次数。默认是6次 如果有一组相关联的消息需要处理,可以分组;只需要设置消息组的名字和这个消息的第几个消息。 如果消息中一个事务环境,则TXID将会被设置。 此外ActiveMQ在服务器端额外设置了消息入队和出队的时间戳。 ActiveMQ里消息属性的值,不仅可以用基本类型,还可以用List或Map类型 Advisory Message:   Advisory Message是ActiveMQ自身的系统消息地址,可以监听该地址来获取activemq的系统消息。目前支持获取如下信息: consumers, producers和connections的启动和停止

ActiveMQ学习第七篇:Message Dispatch(消息发送)的特性

青春壹個敷衍的年華 提交于 2019-12-01 07:16:30
Message Cursors   ActiveMQ发送持久消息的典型处理方式是:当消息的消费者准备就绪时,消息发送系统把存储的消息按批次发送给消费者,在发送完一个批次的消息后,指针的标记位置指向下-批次待发送消息的位置,进行后续的发送操作。这是一种比较健壮和灵活的消息发送方式,但大多数情况下,消息的消费者不是一直处于这种理想的活跃状态。   因此,从ActiveMQ5. 0. 0版本开始,消息发送系统采用一种混合型的发送模式,当消息消费者处理活跃状态时,允许消息发送系统直接把持久消息发送给消费者,当消费者处于不活跃状态下,切换使用Cursors来处理消息的发送。当消息消费者处于活跃状态并且处理能力比较强时,被持久存储的消息直接被发送到与消费者关联的发送队列,如下图   当消息已经出现积压,消费者再开始活跃;或者消费者的消费速度比消息的发送速度慢时,消息将从Pending Cursor中提取,并发送与消费者关联的发送队列。见下图 Store- -based:   从activemq5.0开始,默认使用此种类型的cursor,其能够满足大多数场景的使用要求。同时支持非持久消息的处理,Store-based内 嵌了File-based的模式,非持久消息直接被Non-Persistent Pendi ng Cursor 所处理。工作模式见下图 VM:   相关的消息引用存储在内存中

ActiveMQ学习第九篇:Consumer

こ雲淡風輕ζ 提交于 2019-12-01 07:16:26
Exclusive Consumer:   独有消费者:Queue中的消息是按照顺序被分发到consumer的,然而,当你有多个consumers同时从相同的queue中提取消息时,你将失去这个保证。因为这些消息是被多个线程并发的处理。有的时候,保证消息按照顺序处理是很重要的。例如:你可能不希望在插入订单操作结束之前执行更新这个订单的操作。   ActiveMQ从4.x版本开始支持Exclusive Consumer。Broker会从多个Consumers中挑选一个consumer来处理queue中所有的消息,从而保证了消息的有序处理。如果这个consumer失效,那么broker会自动切换到其他的consumer。可以通过destination options来创建一个Exclusive Consumer,如下: queue = new ActiveMQQueue("TEST.QUEUE?consumer.exclusive=true"); consumer = session.createConsumer(queue); 还可以给consumer设置优先级,以便针对网络情况进行优化,如下: queue = new ActiveMQQueue("TEST.QUEUE?consumer.exclusive=true&consumer.priority=10"); Consumer

HTTP Post From ActiveMQ using Camel

别说谁变了你拦得住时间么 提交于 2019-12-01 06:50:42
We're using camel routes to post values from a queue to an http endpoint. I've successfully set up the route using camel's http component , but I'm unable to get the body of the jms message to post. For example, my route is set up like this: <route errorHandlerRef="dlc" autoStartup="true" id="route2" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring"> <from uri="activemq:test"/> <setHeader headerName="CamelHttpMethod"> <constant>POST</constant> </setHeader> <to uri="http://localhost/tim/camel/" id="to2"/> </route> Which results in a POST, but the

Camel ActiveMQ + Spring boot not reading spring activemq configurations

↘锁芯ラ 提交于 2019-12-01 05:35:42
I am trying a very simple route with Spring Boot 1.5.2.RELEASE + Camel (Spring Boot Starter) + ActiveMQ, which is to read from a particular queue and then log it. However, it looks like it is not picking up my spring.activemq configuration for URL as I see in the log it is trying to connect to a different url and it continues to connect it and the my spring boot app never starts. The questions are based on my configuration that I am providing below how can I do the below: Fix the configuration to allow spring's activemq configuration Configure maxReconnectAttempts so that it does not try to

ActiveMQ:'channel inactive for too long' exceptions stop broker messaging

旧时模样 提交于 2019-12-01 04:42:28
问题 My system has the following parts: ActiveMQ broker exposed on tcp, port 61616 3 Grails/Spring wars that live in their own Tomcat servers, they publish and consume messages to the JMS broker n times remote client system with a JMS listener component to receive client specific messages, connect to the JMS broker through VPN using a hostname and port 61616 So far, all works fine throughout dev, Test and production environments. We've just connected a new client system in production and we've