THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
final String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; final String CONNECTION_JNDI_NAME = "local"; final String CONNECTION_NAME = "amqp://guest:guest@clientid/testpath?brokerlist='vm://:1'"; final String QUEUE_JNDI_NAME = "queue"; final String QUEUE_NAME = "example.MyQueue"; // LoadSet the properties file ... Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); properties.put("connectionfactory."+CONNECTION_JNDI_NAME , CONNECTION_NAME); properties.put("queue."+QUEUE_JNDI_NAME , QUEUE_NAME); // Create the initial context Context ctx = new InitialContext(properties); // Perform the lookups ConnectionFactory factory = (ConnectionFactory)ctx.lookup(CONNECTION_JNDI_NAME); Queue queue = (Queue)ctx.lookup(QUEUE_JNDI_NAME); // Close the context when we're done ctx.close(); |
...