activemq

How to read JMS messages without consuming them - using ActiveMQ

倾然丶 夕夏残阳落幕 提交于 2019-12-01 17:17:23
I would like to know if there is any way to read a jms and actibemq messages without consuming it ?? I know messages can be consumed from the queue , yet still I want ask this question .!! You can browse Messages on a Queue via the JMS QueueBrowser, or in ActiveMQ you can browse the contents over JMX or with the commands line tools: ActiveMQ console tools JMS QueueBrowser API ActiveMQ JMX Narasimha Reddy Lomadi Rather than using Message-consumers you need to use the QueueBrowser class for doing this: ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");

Camel - content enricher: enrich() vs pollEnrich()

和自甴很熟 提交于 2019-12-01 16:46:42
1ST QUESTION: I'm not able to really understand the difference between enrich() and pollEnrich() . Maybe the terms Camel uses are not so great. I read here: http://camel.apache.org/content-enricher.html Content enrichment using the enrich DSL element Camel comes with two flavors of content enricher in the DSL enrich pollEnrich enrich uses a Producer to obtain the additional data. It is usually used for Request Reply messaging, for instance to invoke an external web service. pollEnrich on the other hand uses a Polling Consumer to obtain the additional data. It is usually used for Event Message

Erratic javax.jms.JMSException: Peer disposed

北慕城南 提交于 2019-12-01 16:16:58
问题 I have a erratic problem with Java JMS. For moments works fine, but throws the following exception erratically and cut the execution. It is important to note that this occurs without stopping the broker. javax.jms.JMSException: Peer (vm://test#1) disposed. at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49) at org.apache.activemq.ActiveMQConnection.onAsyncException(ActiveMQConnection.java:1773) at org.apache.activemq.ActiveMQConnection.onException

activemq特性之持久化

こ雲淡風輕ζ 提交于 2019-12-01 15:40:55
介绍 数据的持久化是很多系统都会涉及到的一个问题,尤其是redis,activemq这些数据主要是存储在内存中的。既然存在内存中,就会面临宕机时数据丢失的风险。这一问题的解决方案就是通过某种方式将数据落到磁盘上,也就是所谓的持久化。 activemq提供了三种持久化方式,分别基于jdbc, kahadb和leveldb. 目前官方最推荐的是基于kahadb的持久化。 jdbc是activemq最早提供的一种持久化方式,但是用数据库去做持久化确实不合适,毕竟性能有瓶颈,而且只是需要简单的读写数据,不需要数据库各种强大的功能。现在去看文档的话,连基本的配置都被埋的很深,所以这种方式我们也就不细说了。 正是由于基于jdbc的方式存在的种种问题,activemq后来就接连提供了基于kahabd和leveldb的持久化方式. leveldb 是google开源的一个KV磁盘存储系统,应用很广,kahadb没找着源头,应该就是activemq团队开发的,也是一种基于磁盘的存储系统。按理说,leveldb的性能是要好一些的,之前无论是activemq的默认配置,还是文档里的推荐使用方法,都是首选leveldb. 但是有一天这个基于leveldb的持久化方式就突然被activemq废弃了,主要原因是leveldb是一个第三方系统,维护起来不如kahadb那么方便。到当前最新版本

Camel - content enricher: enrich() vs pollEnrich()

北城以北 提交于 2019-12-01 15:28:08
问题 1ST QUESTION: I'm not able to really understand the difference between enrich() and pollEnrich() . Maybe the terms Camel uses are not so great. I read here: http://camel.apache.org/content-enricher.html Content enrichment using the enrich DSL element Camel comes with two flavors of content enricher in the DSL enrich pollEnrich enrich uses a Producer to obtain the additional data. It is usually used for Request Reply messaging, for instance to invoke an external web service. pollEnrich on the

分布式消息通信ActiveMQ原理-持久化策略-笔记

回眸只為那壹抹淺笑 提交于 2019-12-01 14:02:17
消息的持久化策略分析 消息持久性对于可靠消息传递来说是一种比较好的方法, 即时发送者和接受者不是同时在线或者消息中心在发送者发送消息后宕机了,在消息中心重启后仍然可以将消息发送出去。 消息持久性的原理很简单, 就是在发送消息出去后,消息中心首先将消息存储在本地文件、内存或者远程数据库, 然后把消息发送给接受者, 发送成功后再把消息从存储中删除,失败则继续尝试。 接下来我们来了解一下消息在broker上的持久化存储实现方式 持久化存储支持类型 ActiveMQ支持多种不同的持久化方式,主要有以下几种,不过,无论使用哪种持久化方式,消息的存储逻辑都是一致的。 Ø KahaDB存储(默认存储方式) Ø JDBC存储 Ø Memory存储 Ø LevelDB存储 Ø JDBC With ActiveMQ Journal KahaDB存储 KahaDB是目前 默认的存储方式, 可用于任何场景,提高了性能和恢复能力。 消息存储使用一个事务日志和仅仅用一个 索引文件 来存储它所有的地址。 KahaDB是一个专门针对消息持久化的解决方案,它对典型的消息使用模式进行了优化。 在Kaha中, 数据被追加到data logs中 。 当不再需要log文件中的数据的时候,log文件会被丢弃。 KahaDB的配置方式 <persistenceAdapter> <kahaDB directory="$

ActiveMQ-inAction-ActiveMQ-学习笔记

谁说我不能喝 提交于 2019-12-01 14:01:51
Broker Running Broker ActiveMQ5.0 的二进制发布包中bin目录中包含一个名为activemq的脚本,直接运行这个脚本就可以启动一个broker。 sh activemq start 此外也可以通过Broker Configuration URI或Broker XBean URI对broker 进行配置,以下是一些命令行参数的例子: Example Description activemq Runs a broker using the default 'xbean:activemq.xml' as the broker configuration file. activemq xbean:myconfig.xml Runs a broker using the file myconfig.xml as the broker configuration file that is located in the classpath. activemq xbean:file:./conf/broker1.xml Runs a broker using the file broker1.xml as the broker configuration file that is located in the relative file path ./conf

ActiveMQ 持久化(文件),查询队列剩余消息数、出队数的实现

99封情书 提交于 2019-12-01 14:01:40
本人博客开始迁移,博客整个架构自己搭建及编码 http://www.cookqq.com/listBlog.action 《ActiveMQ发消息和收消息》详细介绍了ActiveMQ发消息和收消息,消息保存在消息队列(queue)中,消息队列数据保存在计算机内存中,假如ActiveMQ服务器由于某些原因突然停止,那消息队列中内容还在吗?用事实说话吧,把ActiveMQ服务器停止,然后再看看ActiveMQ页面上的队列信息queue,如图: activemq_queue队列中的信息全部丢失了。为了解决这个问题,可以把队列数据持久化,分为文件持久化和数据库持久化。 现在详细分析文件持久化。直接来代码吧: 消息发送者: package com.activemq.queue; import javax.jms.Connection; public class Sender { private static final int SEND_NUMBER = 1; public static void main(String[] args) { // ConnectionFactory 接口(连接工厂) 用户用来创建到JMS提供者的连接的被管对象。 // JMS客户通过可移植的接口访问连接,这样当下层的实现改变时,代码不需要进行修改。 // 管理员在JNDI名字空间中配置连接工厂,这样

ActiveMQ 持久化(数据库),查询队列剩余消息数、出队数的实现

天涯浪子 提交于 2019-12-01 14:01:27
《ActiveMQ 持久化(文件),查询队列剩余消息数、出队数的实现》分析了消息队列持久化保存,假如activemq服务器突然停止,服务器启动后,还可以继续查找队列中的消息。现在分析队列中的消息使用数据库持久化。 本人博客开始迁移,博客整个架构自己搭建及编码http://www.cookqq.com/ 消息生产者: package com.activemq.mysql; import java.io.File; import java.util.Properties; import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.Session; import javax.sql.DataSource; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.store.jdbc

ActiveMQ redelivery does not work

我怕爱的太早我们不能终老 提交于 2019-12-01 12:50:28
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.setDeliveryMode(DeliveryMode.PERSISTENT); return jmsTemplate; } @Bean public DefaultJmsListenerContainerFactory