activemq

Count number of messages in a JMS queue

雨燕双飞 提交于 2019-12-03 10:48:41
What is the best way to go over a JMS queue and get all the messages in it? How can count the number of messages in a queue? Thanks. Using JmsTemplate public int getMessageCount(String messageSelector) { return jmsTemplate.browseSelected(messageSelector, new BrowserCallback<Integer>() { @Override public Integer doInJms(Session s, QueueBrowser qb) throws JMSException { return Collections.list(qb.getEnumeration()).size(); } }); } sunleo This is how you can count No of Messages in a Queue public static void main(String[] args) throws Exception { // get the initial context InitialContext ctx = new

ActiveMQ-CPP and Visual Studio 2003

你说的曾经没有我的故事 提交于 2019-12-03 10:20:38
问题 ActiveMQ CPP and Visual Studio 2003 I've have a requirement to get AMQ to work with some code that requires VS 7.1, however I'm having a difficult time getting it and various Apache libraries like apr etc to build using VS 7.1. There is a vs2008 solution/project for AMQ-CPP, I've used that as a template and tried to create one for VS 7.1, However when trying to build, I get errors like the following: "\amq\activemq-cpp-library-3.4.1\src\main\activemq\util\primitivemap.cpp(70): fatal error

ActiveMQ and embedded broker

China☆狼群 提交于 2019-12-03 09:38:39
问题 EDIT: Rephrased the question: I want to use ActiveMQ as a messenger service between my server and client applications. I am trying to set up an embedded broker (i.e. not a separate process) within the server to handle the produced messages for my clients to consume. This queue is persisted. The broker initialisation as follows: BrokerService broker = new BrokerService(); KahaPersistenceAdapter adaptor = new KahaPersistenceAdapter(); adaptor.setDirectory(new File("activemq")); broker

【转】分布式之消息队列复习精讲

眉间皱痕 提交于 2019-12-03 09:36:13
转自: https://www.cnblogs.com/rjzheng/p/8994962.html 引言 为什么写这篇文章? 博主有两位朋友分别是小A和小B: 小A,工作于传统软件行业(某社保局的软件外包公司),每天工作内容就是和产品聊聊需求,改改业务逻辑。再不然就是和运营聊聊天,写几个SQL,生成下报表。又或者接到客服的通知,某某功能故障了,改改数据,然后下班部署上线。每天过的都是这种生活,技术零成长。 小B,工作于某国企,虽然能接触到一些中间件技术。然而,他只会订阅/发布消息。通俗点说,就是调调API。对为什么使用这些中间件啊?如何保证高可用啊?没有充分的认识。 庆幸的是两位朋友都很有上进心,于是博主写这篇文章,帮助他们复习一下关于消息队列中间件这块的要点 复习要点 本文大概围绕如下几点进行阐述: 为什么使用消息队列? 使用消息队列有什么缺点? 消息队列如何选型? 如何保证消息队列是高可用的? 如何保证消息不被重复消费? 如何保证消费的可靠性传输? 如何保证消息的顺序性? 我们围绕以上七点进行阐述。需要说明一下,本文不是《消息队列从入门到精通》这种课程,因此只是提供一个复习思路,而不是去教你们怎么调用消息队列的API。建议对消息队列不了解的人,去找点消息队列的博客看看,再看本文,收获更大 正文 1、为什么要使用消息队列? 分析 :一个用消息队列的人,不知道为啥用,这就有点尴尬

How can I push messages from Activemq to Java Application

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi developers, I want to write 2 .java files using JMS library names are MessageProducer and MessageConsumer . I added activemq-all-5.8.0.jar and commons-io-2.4.jar files in my lib folder.and I changed port number of Activemq from 61616 to 61617 . using MessageProducer.java file,I will send messages to Activemq .For this I wrote code it's working fine.If you want to see click on this Link . I want to send messages from Activemq to MessageConsumer.java .This is Application is in Apache Tomcat ( http://localhost:8080/ExecutableFileProcess

ActiveMQ: how to dequeue older messages?

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm learning how to use ActiveMQ and now we are facing the following problem. Suppose that I have a topic named topic.test on ActiveMQ which have two subscribers. In a given moment, I have only one of those subscribers waiting for messages, and a producer send a message for the topic I mentioned above. Ok, the connected subscriber get the message, but shouldn't the other subscriber receive that message later when it is connected? Well, in my case it's not happening: my subscribers are only receiving messages while connected. All

Ant build classpath jar generates “error in opening zip file”

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a project built in eclipse with a dependencies on 3rd party jars. I'm trying to generate a suitable build file for ant - using eclipses built-in export->ant buildfile feature as a starting block. When I run the build target I get the following error: [javac] error: error reading /base/repo/FabTrace/lib/apache/geronimo/specs/geronimo-j2ee-management_1.0_spec/1.0/geronimo-j2ee-management_1.0_spec-1.0.jar; error in opening zip file And the whole build file (auto-generated by eclipse) looks like this: (NB: the error above always

Using JMS or ThreadPool to send email messages

帅比萌擦擦* 提交于 2019-12-03 08:40:38
I will like to know: I have a scenario. If a user adds a product to the system (I'm developing), there's a listener that sends a notification to the user's client base notifying of a new product added by the user. I've read this thread and (seeing I've never used JMS nor ThreadPool before) I was wondering whether I should use JMS or ThreadPooling. I am using Tomcat 5.5 and higher and JBoss 5 and higher (depending on company last resort) to deploy my web application. If I use JMS, do I use Apache ActiveMQ or JBoss Messaging ? Are they both compatible to run on both platforms (Tomcat and JBoss)?

My C++ ActiveMQ client can send messages, but not receive messages

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the ActiveMQ-CPP 2.2.1 Visual Studio 2005 project compiling and running. In the console window, it shows the messages are being sent, though they're not being received. I can both send and receive messages with ActiveMQ-CPP 2.0.1, but not 2.2.1. I'm new to ActiveMQ and don't even know where to begin troubleshooting. Any thoughts/suggestions/good place to start would be a great help. It if helps, I'm using the ActiveMQ 5.1.0 binary. Thanks in advance! 回答1: I'd recommend posting this to the user forum to get the ActiveMQ C++ developers

How to listen to a message queue from a web application? (Tomcat, ActiveMQ)

一曲冷凌霜 提交于 2019-12-03 08:13:29
I'm happily improving my web application that runs on a Apache Tomcat . An ActiveMQ JMS server is added to send and receive messages. I already can send and receive messages, but need help on the receiver side. How should my web app continuously listen to one queue to receive messages? New messages arrive and the server should act on them. Ex: add data to the DB or or send an message back. I can already send messages. This is code. ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616"); Connection connection = factory.createConnection(); Session session =