-
1. Re: standalone JMS setup without using JNDI
bodrin Jan 5, 2011 9:35 AM (in response to bodrin)FileConfiguration configuration = new FileConfiguration();String url =// server setup - begin
FileConfiguration configuration = new FileConfiguration();
String url = getClass().getResource("/hornetq-config.xml").toString();
configuration.setConfigurationUrl(url);
configuration.start();
HornetQServer server = HornetQServers
.newHornetQServer(configuration);
jmsServerManager = new JMSServerManagerImpl(server);
jmsServerManager.setContext(null);
jmsServerManager.start();
// server setup - end
...
private static JMSQueueControl createJmsQueue(
JMSServerManager jmsServerManager, String queueName,
AddressSettings settings) {
try {
if (jmsServerManager.createQueue(false, queueName, null, true)) {
LOG.info("Queue [" + queueName + "] created.");
} else {
throw new RuntimeException("Failed to create Queue ["
+ queueName + "]");
}
if (settings != null) {
jmsServerManager.addAddressSettings(ResourceNames.JMS_QUEUE
+ queueName, settings);
}
ObjectName on = ObjectNameBuilder.DEFAULT
.getJMSQueueObjectName(queueName);
JMSQueueControl jmsQueueControl = (JMSQueueControl) MBeanServerInvocationHandler
.newProxyInstance(jmsServerManager.getHornetQServer()
.getMBeanServer(), on, JMSQueueControl.class, false);
LOG.info("JMSQueueControl[" + queueName + "] MessageCount: "
+ jmsQueueControl.getMessageCount());
LOG.info("JMSQueueControl[" + queueName + "] DeadLetterAddress: "
+ jmsQueueControl.getDeadLetterAddress());
return jmsQueueControl;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Is this ok?
If I then create a queue (durable) for example this way:
AddressSettings defaultQueueSettings = new AddressSettings(); defaultQueueSettings.setDeadLetterAddress(new SimpleString(DLQ_NAME)); defaultQueueSettings.setMaxSizeBytes(1024 * 1024); // 1 MiB of RAM per queue defaultQueueSettings.setPageSizeBytes(128 * 1024); defaultQueueSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); defaultQueueSettings.setMaxDeliveryAttempts(3);
createJmsQueue(jmsServerManager, "test", defaultQueueSettings);
I can use it and checking in jmx I see org.hornetq/Adress/Core/jms.queue.test/Attributes/NumberOfBytesPerPage=131072.
But when I restart later without creating the queue again I see a difference in jmx:
org.hornetq/Adress/Core/jms.queue.test/Attributes/NumberOfBytesPerPage=10485760
(in queue info DLA is missing also)
Is this normal? If yes how is one supposed to keep the queue config?
Message was edited by: bodri bodri
-
hornetq-config.xml 3.9 KB
-
-
2. standalone JMS setup without using JNDI
bodrin Jan 10, 2011 6:45 AM (in response to bodrin)So if using embedded hornetq in a standalone app without JNDI the AddressSetting persistance is not supported by hornetq?
-
3. Re: standalone JMS setup without using JNDI
bodrin Jan 12, 2011 10:04 AM (in response to bodrin)Occasionally found this http://community.jboss.org/message/559196?tstart=2 :
1. 16-Jun-2010 15:25 (in response to Aspi Engineer)
Re: How do you keep hortnetq JMS and User configuration in sync in a HA setup
Destinations created through the management console or management API are stored on the bindings folder. (the jms journal). If you use shared or replicated journal, all the destinations created at the live will be placed on the backup.
For manual configuration however, you would have to copy the files manually and keep them in sync.
Wold that be an issue for you guys?
But in my setup destinations configuration seems to not be stored anywhere. Any ideas what could e the problem ?