props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.put("java.naming.provider.url", "tcp://localhost:61616");
props.put("topic.topicName", topicName);
javax.naming.Context ctx = new InitialContext(props);
TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");
TopicConnection conn = factory.createTopicConnection();
Topic topic = (Topic) ctx.lookup("topicName");
TopicSession session = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicPublisher publisher = session.createPublisher(topic);
if (message != null) {
Message msg = session.createTextMessage(message);