@@ -0,0 +1,3718 @@
+/*%0A *%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A *%0A */%0Apackage org.apache.qpid.jms.example;%0A%0Aimport java.util.Properties;%0A%0Aimport javax.jms.Connection;%0Aimport javax.jms.ConnectionFactory;%0Aimport javax.jms.DeliveryMode;%0Aimport javax.jms.Destination;%0Aimport javax.jms.ExceptionListener;%0Aimport javax.jms.JMSException;%0Aimport javax.jms.Message;%0Aimport javax.jms.MessageConsumer;%0Aimport javax.jms.MessageProducer;%0Aimport javax.jms.Session;%0Aimport javax.jms.TextMessage;%0Aimport javax.naming.Context;%0Aimport javax.naming.InitialContext;%0A%0Apublic class HelloWorld %7B%0A    private static final String USER = %22guest%22;%0A    private static final String PASSWORD = %22guest%22;%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        try %7B%0A            // JNDI information can be configured by including an file named jndi.properties%0A            // on the classpath, containing the %22java.naming.factory.initial%22 configuration%0A            // and properties configuring required ConnectionFactory and Destination objects.%0A            // The below is an alternative approach being used only for the examples.%0A            Properties env = new Properties();%0A            env.put(Context.INITIAL_CONTEXT_FACTORY, %22org.apache.qpid.jms.jndi.JmsInitialContextFactory%22);%0A            env.put(Context.PROVIDER_URL, ClassLoader.getSystemResource(%22org/apache/qpid/jms/example/example-jndi.properties%22).toExternalForm());%0A%0A            Context context = new InitialContext(env);%0A%0A            ConnectionFactory factory = (ConnectionFactory) context.lookup(%22myFactoryLookup%22);%0A            Destination queue = (Destination) context.lookup(%22myQueueLookup%22);%0A%0A            Connection connection = factory.createConnection(USER, PASSWORD);%0A            connection.setExceptionListener(new MyExceptionListener());%0A            connection.start();%0A%0A            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A%0A            MessageProducer messageProducer = session.createProducer(queue);%0A            MessageConsumer messageConsumer = session.createConsumer(queue);%0A%0A            TextMessage message = session.createTextMessage(%22Hello world!%22);%0A            messageProducer.send(message, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);%0A            TextMessage receivedMessage = (TextMessage) messageConsumer.receive(2000L);%0A            System.out.println(receivedMessage.getText());%0A%0A            connection.close();%0A        %7D catch (Exception exp) %7B%0A            System.out.println(%22Caught exception, exiting.%22);%0A            exp.printStackTrace(System.out);%0A            System.exit(1);%0A        %7D%0A    %7D%0A%0A    private static class MyExceptionListener implements ExceptionListener %7B%0A        @Override%0A        public void onException(JMSException exception) %7B%0A            System.out.println(%22Connection ExceptionListener fired, exiting.%22);%0A            exception.printStackTrace(System.out);%0A            System.exit(1);%0A        %7D%0A    %7D%0A%7D

add a basic HelloWorld example