Package javax.jms

Examples of javax.jms.MessageListener


  
   public Object handleSetMessageListener(Invocation invocation) throws Throwable
   {  
      MethodInvocation mi = (MethodInvocation)invocation;
      Object[] args = mi.getArguments();
      MessageListener l = (MessageListener)args[0];
     
      getMessageCallbackHandler(invocation).setMessageListener(l);
     
      return null;
   }
View Full Code Here


   {
      if (trace) { log.trace("setMessageListener()"); }
     
      MethodInvocation mi = (MethodInvocation)invocation;
     
      MessageListener listener = (MessageListener)mi.getArguments()[0];
     
      if (listener == null)
      {
         throw new IllegalStateException("Cannot set a null MessageListener on the session");
      }
View Full Code Here

               if (trace) { log.trace("there are " + mesList.size() + " messages to send to session"); }

               ServerSession serverSession = serverSessionPool.getServerSession();
               JBossSession session = (JBossSession)serverSession.getSession();

               MessageListener listener = session.getMessageListener();

               if (listener == null)
               {
                  // Sanity check
                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
View Full Code Here

      final Result result = new Result();
      Connection conn = cf.createConnection();
      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      final MessageConsumer cons = s.createConsumer(queue);
      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            // close the connection on the same thread that processed the message
            try
View Full Code Here

      final Result result = new Result();
      Connection conn = cf.createConnection();
      final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer cons = session.createConsumer(queue);
      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            // close the connection on the same thread that processed the message
            try
View Full Code Here

      final Result result = new Result();
      final Connection conn = cf.createConnection();
      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer cons = s.createConsumer(queue);
      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            // close the connection on the same thread that processed the message
            try
View Full Code Here

      MessageConsumer cons = session.createConsumer(queue);

      final Slot slot = new Slot();

      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            try
            {
View Full Code Here

      if (consumer == null)
      {
         throw new Exception("You need to create a consumer first. " +
                             "Use createConsumer(destination)");
      }
      consumer.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            System.out.println("MessageLister got message: " + m);
         }
View Full Code Here

      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue) context.lookup(TEST_QUEUE);

      QueueReceiver receiver = session.createReceiver(queue);
      receiver.setMessageListener(new MessageListener()
      {
         public void onMessage(Message msg)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("ML");
            try
            {
               if (msg instanceof TextMessage)
               {
                  log.debug(((TextMessage) msg).getText());
                  counter1.release();
               }
            }
            catch (Exception e)
            {
            }
         }
      });

      QueueSender sender = session.createSender(queue);

      TextMessage message = session.createTextMessage();
      message.setText("Normal message");
      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
      message.setText("Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
      message.setText("High Priority Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);

      // Wait for the msgs to be received
      counter1.acquire();
      log.debug("MessageListener1 received the TMs sent");

      final CountDown counter2 = new CountDown(2);
      receiver.setMessageListener(new MessageListener()
      {
         public void onMessage(Message msg)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("ML 2");
View Full Code Here

      connect();

      Queue testQueue = (Queue) context.lookup(TEST_QUEUE);
      final QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      session.setMessageListener(new MessageListener()
      {
         public void onMessage(Message mess)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("Processing message");
View Full Code Here

TOP

Related Classes of javax.jms.MessageListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.