Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMS / HornetQ = How to Create a JMS Queue programmatically from the client?

Tags:

java

jms

hornetq

I know that JMS Queues can be created in HornetQ via the hornetq-jmx.xml Configuration file. But I want to do this from the client?

I tried:

HornetQJMSClient.createQueue(queueName);

but this seems to not create the queue (on the hornetq server)? I always get an exception that the queue is unknown when I try to create a consumer for this queue.

I would be very thankfull for advice how to create JMS Queues from the client. (I do not Want to use JNDI at all, neither on the client nor on the server, if possible).

Update:

I would not mind using any of HornetQs Core APIs (as opposed to the JMS APis) to create the queues from the client. My question is: Is there any way to create queues from the client (either with JMS Apis or with the HornetQ Core APIs).

like image 930
Markus Avatar asked Aug 10 '11 14:08

Markus


1 Answers

You don't... It needs that you specify in it's configuration files the Queues's names (JMS or Core queues).

Even though the name implies it, you don't 'create' the queue when you call createQueue() method, you just do a lookup and register it on your client side to use it (so it checks if it exists or not).

The closest you'll get from it is creating Temporary Queues, usually when you implement a Request-Response behavior.

like image 126
everton Avatar answered Sep 21 '22 16:09

everton