EJB / EE :: ActiveMQ - Use Of Durable Subscriber

Jun 27, 2014

I am trying to test out the use of durable subscribers with activeMQ. I create the subscriber

connection.setClientID(clientId);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

destination = session.createTopic("my.topic");
MessageConsumer consumer = session.createDurableSubscriber(destination, subscriptionName, null, false);

I then receive the message synchronously. No message as expected.If use ActiveMQ web admin console, it shows the topic, with enqueue and dequeue of 0.

I then run the test to send messages, and then exits

session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = session.createTopic("my.topic");
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);

String text = "Hello World! (" + i+ ")";
message = session.createTextMessage(text);
producer.send(message);

The test exits and if I look at the ActiveMQ admin console, it now shows two messages enqueued, 0 dequeued
This seems ok

Finally i run the consumer test again. It receives the messages just fine. But again the ActiveMQ admin console shows two messages enqueued and , 0 dequeued. It always shows 0 dequeued.

I even changed the test so that instead of doing a sync receive it used an async receive with a listener...but still the same behavior. The topic dequeued value is always 0 on the Topics base of the ActiveMQ web console.

View Replies


ADVERTISEMENT

EJB / EE :: List Durable Subscriptions From JMS Topic

Jun 24, 2014

We have a requirement to list all the durable subscriptions from the JMS topic and written below code to get the Topic name

Topic topic = null;
Properties p = new Properties( );
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES," org.jboss.namingrg.jnp.interfaces");
Context ctx = new InitialContext(p);

[Code] .....

View Replies View Related

EJB / EE :: Reject Duplicate Messages In ActiveMq

Jun 13, 2014

I am using ActiveMq alongwith Spring in my project. I want my queue to be configured to reject the duplicate messages.I tried my level best to do so. I tried googling for the same. but could not get anything.

View Replies View Related

Getting NullPointer Exception In Unit Test At Activemq Connection Factory Creation

Dec 2, 2014

I have the following unit test that gives me a null pointer exception. The debugger goes to the finally block right after the line that creates a connection factory. Here's the test:

@Test
public void receiveMessage() throws Exception {
MessageConsumer consumer = null;
ConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
Destination destination = null;

[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved