yes its 100% safe as long as you create them as durable
Thanks for your response.
I've created a queue under org.hornetq.Queue.Core, named (Q_TEST_JMS).
But we can't use it from our java code.
HornetQ logs only contains this error :
Connection failure has been detected: Did not receive ping from /x.x.x.x:49589. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. The connection will now be closed. [code=3]
If we try to use a queue created manually, it work.
Do you think it's a queue setup problem ?
Thanks in advance
...and this error from the client console
Exception in thread "main" javax.naming.NameNotFoundException: Q_TEST_JMS not bound
you probably created a core queue, not a JMS queue.
What object did you use?
take a look at the user manual to see how core queues differe from jms queues, also you could use the jms management api to create the queues instead
I have tried to create a core queue and a jms queue.
In both case, i get
Q_xxxxxx not bound
I take a look at the user guide but can't find my trouble at this point...
Thanks for your replies
posting some of your code may help?
Yep. I'm sure you know the author of this example
You can take a look at the JMX console when i create the queue.
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
* @author <a href="firstname.lastname@example.org">Andy Taylor</a>
public class QueueExample
protected static Logger log = Logger.getLogger(QueueExample.class.getName());
public static void main(final String args) throws Exception
QueueExample ex = new QueueExample();
public boolean runExample() throws Exception
Connection connection = null;
InitialContext initialContext = null;
// Step 1. Create an initial context to perform the JNDI lookup.
initialContext = getContext(0);
// Step 2. Perfom a lookup on the queue
Queue queue = (Queue)initialContext.lookup("queue/Q_JMS_TEST");
// Step 3. Perform a lookup on the Connection Factory
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
// Step 4.Create a JMS Connection
connection = cf.createConnection();
// Step 5. Create a JMS Session
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Step 6. Create a JMS Message Producer
MessageProducer producer = session.createProducer(queue);
// Step 7. Create a Text Message
TextMessage message = session.createTextMessage("This is a text message");
System.out.println("Sent message: " + message.getText());
// Step 8. Send the Message
for(int i = 0; i < 1000; i++)
// Step 9. Create a JMS Message Consumer
MessageConsumer messageConsumer = session.createConsumer(queue);
// Step 10. Start the Connection
// Step 11. Receive the message
TextMessage messageReceived = null;
while((messageReceived = (TextMessage)messageConsumer.receive(5000)) != null)
System.out.println("Received message: " + messageReceived.getText());
// Step 12. Be sure to close our JMS resources!
if (initialContext != null)
if (connection != null)
protected InitialContext getContext(final int serverId) throws Exception
String jndiFilename = "server" + serverId + "/client-jndi.properties";
File jndiFile = new File(jndiFilename);
log.info("using " + jndiFile + " for jndi");
Properties props = new Properties();
FileInputStream inStream = null;
inStream = new FileInputStream(jndiFile);
if (inStream != null)
return new InitialContext(props);
you need to set the jndiBindings as well, this is what the queue will be bound to jndi with
Great ! it works.
Now i have to find how can the queue can be used after a service restart. (it's appear under the core section but not under JMS)
Answer is probably int the user guide ?