[jboss-cvs] JBoss Messaging SVN: r6228 - in trunk/examples: jms and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 31 05:59:55 EDT 2009


Author: ataylor
Date: 2009-03-31 05:59:55 -0400 (Tue, 31 Mar 2009)
New Revision: 6228

Removed:
   trunk/examples/build.properties
   trunk/examples/jms/config/
   trunk/examples/jms/other-system-client-dir/
   trunk/examples/jms/src/org/jboss/jms/example/ClusteredQueueExample.java
   trunk/examples/jms/src/org/jboss/jms/example/DurableSubscriberExample.java
   trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java
   trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java
   trunk/examples/jms/src/org/jboss/jms/example/MessageGroupingExample.java
   trunk/examples/jms/src/org/jboss/jms/example/ScheduledExample.java
   trunk/examples/jms/src/org/jboss/jms/example/Sender.java
   trunk/examples/jms/src/org/jboss/jms/example/SoloMessageTopicExample.java
   trunk/examples/jms/src/org/jboss/jms/example/WildcardExample.java
   trunk/examples/messaging/
Log:
deleted unwanted examples

Deleted: trunk/examples/build.properties
===================================================================
--- trunk/examples/build.properties	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/build.properties	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,6 +0,0 @@
-lib.dir=../../thirdparty
-client.core.jar=../../build/jars/jbm-core-client.jar
-transports.jar=../../build/jars/jbm-transports.jar
-jms.jar=../../build/jars/jbm-jms.jar
-core.jar=../../build/jars/jbm-core.jar
-

Deleted: trunk/examples/jms/src/org/jboss/jms/example/ClusteredQueueExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/ClusteredQueueExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/ClusteredQueueExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,114 +0,0 @@
-/*
-   * JBoss, Home of Professional Open Source
-   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-   * by the @authors tag. See the copyright.txt in the distribution for a
-   * full listing of individual contributors.
-   *
-   * This is free software; you can redistribute it and/or modify it
-   * under the terms of the GNU Lesser General Public License as
-   * published by the Free Software Foundation; either version 2.1 of
-   * the License, or (at your option) any later version.
-   *
-   * This software is distributed in the hope that it will be useful,
-   * but WITHOUT ANY WARRANTY; without even the implied warranty of
-   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   * Lesser General Public License for more details.
-   *
-   * You should have received a copy of the GNU Lesser General Public
-   * License along with this software; if not, write to the Free
-   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-   */
-package org.jboss.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-import java.util.Hashtable;
-
-/**
- * A simple JMS Queue example that creates a producer and consumer on a queue and sends a message.
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class ClusteredQueueExample
-{
-   final static Logger log = Logger.getLogger(ClusteredQueueExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      Connection connection2 = null;
-      try
-      {
-         Hashtable<Object, Object> server1 = new Hashtable<Object, Object>();
-         server1.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
-         server1.put("java.naming.provider.url", "jnp://localhost:1099");
-         server1.put("java.naming.factory.url.pkg", "org.jboss.naming:org.jnp.interfaces");
-         InitialContext initialContext1 = new InitialContext(server1);
-         Hashtable<Object, Object> server2 = new Hashtable<Object, Object>();
-         server2.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
-         server2.put("java.naming.provider.url", "jnp://localhost:1097");
-         server2.put("java.naming.factory.url.pkg", "org.jboss.naming:org.jnp.interfaces");
-         InitialContext initialContext2 = new InitialContext(server2);
-         Queue queue = (Queue) initialContext1.lookup("/queue/testDistributedQueue");
-         ConnectionFactory cf = (ConnectionFactory) initialContext1.lookup("/ClusteredConnectionFactory");
-         ConnectionFactory cf2 = (ConnectionFactory) initialContext2.lookup("/ClusteredConnectionFactory");
-
-         connection = cf.createConnection();
-         connection2 = cf2.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue);
-         Message message = session.createTextMessage("This is a text message!");
-
-         log.info("sending message to queue");
-         producer.send(message);
-
-         MessageConsumer messageConsumer = session2.createConsumer(queue);
-         connection.start();
-         TextMessage message2 = (TextMessage) messageConsumer.receive(5000);
-         log.info("message received from queue");
-         log.info("message = " + message2.getText());
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-      finally
-      {
-         if(connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-         if(connection2 != null)
-         {
-            try
-            {
-               connection2.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}
\ No newline at end of file

Deleted: trunk/examples/jms/src/org/jboss/jms/example/DurableSubscriberExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/DurableSubscriberExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/DurableSubscriberExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,89 +0,0 @@
-/*
-   * JBoss, Home of Professional Open Source
-   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-   * by the @authors tag. See the copyright.txt in the distribution for a
-   * full listing of individual contributors.
-   *
-   * This is free software; you can redistribute it and/or modify it
-   * under the terms of the GNU Lesser General Public License as
-   * published by the Free Software Foundation; either version 2.1 of
-   * the License, or (at your option) any later version.
-   *
-   * This software is distributed in the hope that it will be useful,
-   * but WITHOUT ANY WARRANTY; without even the implied warranty of
-   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   * Lesser General Public License for more details.
-   *
-   * You should have received a copy of the GNU Lesser General Public
-   * License along with this software; if not, write to the Free
-   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-   */
-package org.jboss.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-import javax.naming.InitialContext;
-
-/**
- * A simple JMS Durable Subscriber example.
- * 
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class DurableSubscriberExample
-{
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Topic topic = (Topic) initialContext.lookup("/topic/testTopic");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         connection = cf.createConnection();
-         connection.setClientID("myclientid");
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         session.createDurableSubscriber(topic, "myuniqueid");
-         connection.close();
-
-         connection = cf.createConnection();         
-         connection.setClientID("myclientid");
-         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer messageProducer = session.createProducer(topic);
-         Message message = session.createTextMessage("This is a text message!");
-         messageProducer.send(message);
-         TopicSubscriber topicSubscriber =  session.createDurableSubscriber(topic, "myuniqueid");
-         connection.start();
-         TextMessage message2 = (TextMessage) topicSubscriber.receive();
-         System.out.println("message = " + message2.getText());
-         topicSubscriber.close();
-         session.unsubscribe("myuniqueid");
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-      finally
-      {
-         if (connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}

Deleted: trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/EJB3MDBExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import javax.jms.TextMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.Session;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.MessageListener;
-import javax.naming.InitialContext;
-import javax.ejb.MessageDriven;
-import javax.ejb.ActivationConfigProperty;
-
-/**
- * A MDB3 EJB example.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision: 2868 $</tt>
-
- * $Id: EJB3MDBExample.java 2868 2007-07-10 20:22:16Z timfox $
- */
- at MessageDriven(activationConfig =
-{
-      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
-      @ActivationConfigProperty(propertyName="destination", propertyValue="queue/testQueue"),
-      @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
-})
-public class EJB3MDBExample implements MessageListener
-{
-   public EJB3MDBExample()
-   {
-      System.out.println("this = " + this);
-   }
-
-   public void onMessage(Message m)
-   {
-      businessLogic(m);
-   }
-
-   private void businessLogic(Message m)
-   {
-      Connection conn = null;
-      Session session = null;
-
-      try
-      {
-         TextMessage tm = (TextMessage)m;
-
-         String text = tm.getText();
-         System.out.println("message " + text + " received");
-
-         System.out.print("Sleeping for 2 secs");
-         Thread.sleep(2000);
-         System.out.println("awake: sending message");
-
-         InitialContext ic = new InitialContext();
-         ConnectionFactory cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
-         ic.close();
-
-         conn = cf.createConnection();
-         conn.start();
-         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-         Destination replyTo = m.getJMSReplyTo();
-         MessageProducer producer = session.createProducer(replyTo);
-         TextMessage reply = session.createTextMessage(text);
-
-         producer.send(reply);
-         producer.close();
-
-      }
-      catch(Exception e)
-      {
-         e.printStackTrace();
-         System.out.println("The Message Driven Bean failed!");
-      }
-      finally
-      {
-         if (conn != null)
-         {
-            try
-            {
-               conn.close();
-            }
-            catch(Exception e)
-            {
-               System.out.println("Could not close the connection!" +e);
-            }
-         }
-      }
-   }
-}
-
-
-

Deleted: trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.jms.JBossTopic;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class InVMExample
-{
-   public static void main(String[] args) throws Exception
-   {
-      MessagingServer server = null;
-      ConfigurationImpl configuration = new ConfigurationImpl();
-      configuration.setSecurityEnabled(false);
-      configuration.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      server = Messaging.newNullStorageMessagingServer(configuration);
-      // start the server
-      server.start();
-      JMSServerManager serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
-      serverManager.start();
-      // if you want to lookup the objects via jndi, use a proper context
-      serverManager.setContext(new NullInitialContext());
-      ConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()));
-
-      Connection conn = cf.createConnection();
-      conn.setClientID("myid");
-      // some queue stuff
-      Queue q = new JBossQueue("queueA");
-      serverManager.createQueue(q.getQueueName(), q.getQueueName());
-      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      MessageProducer prod = sess.createProducer(q);
-      prod.send(sess.createTextMessage("hello"));
-      MessageConsumer cons = sess.createConsumer(q, null, false);
-      conn.start();
-      TextMessage message = (TextMessage)cons.receive(5000);
-      System.out.println("message.getText() = " + message.getText());
-
-      // some topic stuff
-      Topic topic = new JBossTopic("topicA");
-      serverManager.createTopic(topic.getTopicName(), topic.getTopicName());
-      prod = sess.createProducer(topic);
-      TopicSubscriber sub = sess.createDurableSubscriber(topic, "mySub", null, false);
-      prod.send(sess.createTextMessage("hello again"));
-      message = (TextMessage)sub.receive(5000);
-      System.out.println("message.getText() = " + message.getText());
-
-      conn.close();
-      // stop the server
-      server.stop();
-   }
-
-   static class NullInitialContext extends InitialContext
-   {
-
-      public NullInitialContext() throws NamingException
-      {
-         super();
-      }
-
-      @Override
-      public void rebind(String name, Object obj) throws NamingException
-      {
-      }
-   }
-
-}

Deleted: trunk/examples/jms/src/org/jboss/jms/example/MessageGroupingExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/MessageGroupingExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/MessageGroupingExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,166 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import java.util.concurrent.CountDownLatch;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * This example sends 20 messages setting the groupid so that a specific consumer will receive each message.
- * setting the property 'JMSXGroupID' will bind a consumer to the value given, from this point on the same consumer will
- * receive any message that has the same JMSXGroupID value.
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class MessageGroupingExample
-{
-   final static Logger log = Logger.getLogger(MessageGroupingExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Queue queue = (Queue) initialContext.lookup("/queue/testGroupQueue");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue);
-         Message[] messages = new Message[20];
-         for (int i = 0; i < messages.length; i++)
-         {
-            if (i < messages.length/2)
-            {
-               if(i % 2 == 1)
-               {
-                  messages[i] = session.createTextMessage("This is a text message from groupid1!");
-                  messages[i].setStringProperty("JMSXGroupID", "groupid1");
-               }
-               else
-               {
-                  messages[i] = session.createTextMessage("This is a text message from groupid3!");
-                  messages[i].setStringProperty("JMSXGroupID", "groupid3");
-               }
-            }
-            else
-            {
-               messages[i] = session.createTextMessage("This is a text message from groupid2!");
-               messages[i].setStringProperty("JMSXGroupID", "groupid2");
-            }
-         }
-
-         final CountDownLatch latch = new CountDownLatch(20);
-         MessageConsumer messageConsumer = session.createConsumer(queue);
-         messageConsumer.setMessageListener(new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-               TextMessage m = (TextMessage) message;
-               try
-               {
-                  log.info("message received for consumer 1 = " + m.getText());
-               }
-               catch (JMSException e)
-               {
-                  e.printStackTrace();
-               }
-               latch.countDown();
-            }
-         });
-         MessageConsumer messageConsumer2 = session.createConsumer(queue);
-         messageConsumer2.setMessageListener(new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-              TextMessage m = (TextMessage) message;
-               try
-               {
-                  log.info("message received for consumer 2 = " + m.getText());
-               }
-               catch (JMSException e)
-               {
-                  e.printStackTrace();
-               }
-               latch.countDown();
-            }
-         });
-         MessageConsumer messageConsumer3 = session.createConsumer(queue);
-         messageConsumer3.setMessageListener(new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-              TextMessage m = (TextMessage) message;
-               try
-               {
-                  log.info("message received for consumer 3 = " + m.getText());
-               }
-               catch (JMSException e)
-               {
-                  e.printStackTrace();
-               }
-               latch.countDown();
-            }
-         });
-         connection.start();
-
-         log.info("sending messages to queue");
-         for (Message message : messages)
-         {
-            producer.send(message);
-         }
-         latch.await();
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-      finally
-      {
-         if(connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-            }
-         }
-      }
-   }
-}
\ No newline at end of file

Deleted: trunk/examples/jms/src/org/jboss/jms/example/ScheduledExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/ScheduledExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/ScheduledExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class ScheduledExample
-{
-   final static Logger log = Logger.getLogger(ScheduledExample.class);
-
-   public static void main(final String[] args)
-   {
-      DateFormat df = new SimpleDateFormat("hh:mm:ss");
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue);
-         Message message = session.createTextMessage("This is a text message!");
-         Calendar cal = Calendar.getInstance();
-         log.info("current time " + df.format(cal.getTime()));
-         cal.add(Calendar.SECOND, 5);
-         log.info("message scheduled for " + df.format(cal.getTime()));
-         message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME", cal.getTimeInMillis());
-         log.info("sending message to queue");
-         producer.send(message);
-
-         MessageConsumer messageConsumer = session.createConsumer(queue);
-         connection.start();
-         TextMessage message2 = (TextMessage) messageConsumer.receive(7000);
-         log.info("message received at " + df.format(Calendar.getInstance().getTime()));
-         log.info("message = " + message2.getText());
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-      finally
-      {
-         if(connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}

Deleted: trunk/examples/jms/src/org/jboss/jms/example/Sender.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/Sender.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/Sender.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Queue;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-import javax.jms.Session;
-import javax.jms.MessageListener;
-import javax.jms.Message;
-import javax.jms.JMSException;
-import javax.naming.InitialContext;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class Sender
-{
-   public static void main(String[] args) throws Exception
-   {
-      String destinationName = "/queue/testQueue";
-      InitialContext ic = new InitialContext();
-      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      Queue queue = (Queue)ic.lookup(destinationName);
-
-      Connection connection = cf.createConnection();
-      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      MessageProducer sender = session.createProducer(queue);
-
-      Queue temporaryQueue = session.createTemporaryQueue();
-      MessageConsumer consumer = session.createConsumer(temporaryQueue);
-      final CountDownLatch latch = new CountDownLatch(30);
-      consumer.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message message)
-         {
-            try
-            {
-               TextMessage m = (TextMessage)message;
-               System.out.println("received " + m.getText());
-               latch.countDown();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      });
-
-      connection.start();
-
-      for(int i = 1; i <= 30; i++)
-      {
-         TextMessage message = session.createTextMessage("Message " + i);
-         message.setJMSReplyTo(temporaryQueue);
-         sender.send(message);
-      }
-      latch.await(60, TimeUnit.SECONDS);
-      connection.close();
-   }
-}

Deleted: trunk/examples/jms/src/org/jboss/jms/example/SoloMessageTopicExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/SoloMessageTopicExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/SoloMessageTopicExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,120 +0,0 @@
-/*
-   * JBoss, Home of Professional Open Source
-   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-   * by the @authors tag. See the copyright.txt in the distribution for a
-   * full listing of individual contributors.
-   *
-   * This is free software; you can redistribute it and/or modify it
-   * under the terms of the GNU Lesser General Public License as
-   * published by the Free Software Foundation; either version 2.1 of
-   * the License, or (at your option) any later version.
-   *
-   * This software is distributed in the hope that it will be useful,
-   * but WITHOUT ANY WARRANTY; without even the implied warranty of
-   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   * Lesser General Public License for more details.
-   *
-   * You should have received a copy of the GNU Lesser General Public
-   * License along with this software; if not, write to the Free
-   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-   */
-package org.jboss.jms.example;
-
-import java.util.concurrent.CountDownLatch;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.ObjectMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * A simple JMS Topic example that creates a producer and consumer on a queue and sends and receives a message via a
- * Message Listener..
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class SoloMessageTopicExample
-{
-   final static Logger log = Logger.getLogger(SoloMessageTopicExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Topic topic = (Topic) initialContext.lookup("/topic/testSoloTopic");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer messageProducer = session.createProducer(topic);
-
-         MessageConsumer messageConsumer = session.createConsumer(topic);
-         Message message = session.createObjectMessage(101.10);
-         message.setStringProperty("_JBM_SOLO_MESSAGE", "SHARE_PRICE");
-         Message message2 = session.createObjectMessage(121.10);
-         message2.setStringProperty("_JBM_SOLO_MESSAGE", "SHARE_PRICE");
-         final CountDownLatch latch = new CountDownLatch(1);
-         messageConsumer.setMessageListener(new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-               try
-               {
-                  log.info("message received from topic");
-                  ObjectMessage textMessage = (ObjectMessage) message;
-                  log.info("Share Price is £" + textMessage.getObject());
-               }
-               catch (JMSException e)
-               {
-                  e.printStackTrace();
-               }
-               latch.countDown();
-            }
-         });
-
-         log.info("publishing message to topic");
-         messageProducer.send(message);
-         messageProducer.send(message2);
-         connection.start();
-         try
-         {
-            latch.await();
-         }
-         catch (InterruptedException e)
-         {
-         }
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-
-      finally
-      {
-         if (connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}
\ No newline at end of file

Deleted: trunk/examples/jms/src/org/jboss/jms/example/WildcardExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/WildcardExample.java	2009-03-31 09:55:00 UTC (rev 6227)
+++ trunk/examples/jms/src/org/jboss/jms/example/WildcardExample.java	2009-03-31 09:59:55 UTC (rev 6228)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class WildcardExample
-{
-   final static Logger log = Logger.getLogger(WildcardExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Topic topicA = (Topic) initialContext.lookup("/topic/topicA");
-         Topic topicB = (Topic) initialContext.lookup("/topic/topicB");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer messageProducerA = session.createProducer(topicA);
-         MessageProducer messageProducerB = session.createProducer(topicB);
-
-         Topic wildCardTopic = session.createTopic("topic.*");
-         //or alternatively new JBossTopic("topic.*");
-         MessageConsumer messageConsumer = session.createConsumer(wildCardTopic);
-         Message messageA = session.createTextMessage("This is a text message from TopicA!");
-         Message messageB = session.createTextMessage("This is a text message from TopicB!");
-         connection.start();
-
-         log.info("publishing message to topicA");
-         messageProducerA.send(messageA);
-         log.info("publishing message to topicB");
-         messageProducerB.send(messageB);
-
-         TextMessage msg1 = (TextMessage) messageConsumer.receive(5000);
-         log.info("received message = " + msg1.getText());
-         TextMessage msg2 = (TextMessage) messageConsumer.receive(5000);
-         log.info("received message = " + msg2.getText());
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-
-      finally
-      {
-         if (connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}




More information about the jboss-cvs-commits mailing list