JMS / HornetQ = How to create a JMS queue programmatically from a client?

I know that JMS queues can be created in HornetQ through the hornetq-jmx.xml configuration file. But I want to do this from a client?

I tried:

 HornetQJMSClient.createQueue(queueName); 

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

I would be very grateful for the advice on 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 the HornetQs Core APIs (unlike JMS APis) to create queues from the client. My question is: is there a way to create queues from the client (either with Apis JMS, or using the HornetQ Core API).

+6
source share
3 answers

You don’t have ... To do this, you need to specify the names of the queues in the configuration files (JMS or Core queues).

Despite the fact that this name implies this, you do not create a queue when you call the createQueue () method, you simply search and register it on your client side to use it (so it checks to see if it exists or not).

Closest to you will receive temporary queues from it, usually when implementing Request-Response behavior.

+2
source

You can use the management API to create queues.

In a future version (possibly 2.3.0), session.createQueue and createTopic will also create physical queues (if you have authorization, of course).

+2
source

This may help a little in creating a queue using the basic APIs: http://community.jboss.org/message/624481

+1
source

Source: https://habr.com/ru/post/894721/


All Articles