private String queuePrefix = "queue.";
private String topicPrefix = "topic.";
public Context getInitialContext(Hashtable environment) throws NamingException {
// lets create a factory
Map data = new ConcurrentHashMap();
ActiveMQConnectionFactory factory = createConnectionFactory(environment);
data.put("ConnectionFactory", factory);
data.put("QueueConnectionFactory", factory);
data.put("TopicConnectionFactory", factory);
createQueues(data, environment);
createTopics(data, environment);
try {
Broker broker = factory.getEmbeddedBroker();
if (broker != null) {
data.put("destinations", broker.getDestinationContext(environment));
}
}
catch (JMSException e) {
CommunicationException exception = new CommunicationException("Failed to access embedded broker: " + e);
exception.setRootCause(e);