Package javax.jms

Examples of javax.jms.MessageListener


        Connection conn = getConnectionResource().borrowConnection();
        try {
            Session session = conn.createSession(isTransacted(), isTransacted() ? Session.SESSION_TRANSACTED : Session.AUTO_ACKNOWLEDGE);
            Destination destination = getEndpoint().getDestinationCreationStrategy().createDestination(session, getDestinationName(), isTopic());
            MessageConsumer messageConsumer = JmsObjectFactory.createMessageConsumer(session, destination, getMessageSelector(), isTopic(), getDurableSubscriptionId());
            MessageListener handler = createMessageHandler(session);
            messageConsumer.setMessageListener(handler);

            answer = new MessageConsumerResources(session, messageConsumer);
        } catch (Exception e) {
            log.error("Unable to create the MessageConsumer", e);
View Full Code Here


   {
      public void run()
      {        
         MessageProxy mp = null;
        
         MessageListener theListener = null;
        
         synchronized (mainLock)
         {
            if (listener == null || buffer.isEmpty())
            {
View Full Code Here

  
   public Object handleSetMessageListener(Invocation invocation) throws Throwable
   {  
      MethodInvocation mi = (MethodInvocation)invocation;
      Object[] args = mi.getArguments();
      MessageListener l = (MessageListener)args[0];
     
      getClientConsumer(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

   {
      JBossConnectionFactory cf1 = (JBossConnectionFactory)ic[1].lookup("/ConnectionFactory");
      Connection conn1 = cf1.createConnection();
      Session sess1 = conn1.createSession(false, Session.CLIENT_ACKNOWLEDGE);
      MessageConsumer cons1 = sess1.createConsumer(queue[1]);
      cons1.setMessageListener(new MessageListener() {
         public void onMessage(Message m)
         {
            try
            {
               log.error("receiving " + m);
View Full Code Here

        {
            failAsyncTest("Max Delivery feature is not supported with this acknowledgement mode" +
                        "when using asynchronous message delivery.");
        }

        consumer.setMessageListener(new MessageListener()
        {
            private int _deliveryAttempts = 0; //number of times given message(s) have been seen
            private int _numMsgsToBeRedelivered = 0; //number of messages to rollback/recover
            private int _totalNumDeliveries = 0;
            private int _expectedMessage = 1;
View Full Code Here

        _connection.start();

        _message = null;
        _receiveMessage = new CountDownLatch(1);

        consumer.setMessageListener(new MessageListener()
        {
            public void onMessage(Message message)
            {
                _message = message;
                _receiveMessage.countDown();
View Full Code Here

        _connection =  (AMQConnection) getConnection("guest", "guest");

        _destination1 = new AMQQueue(_connection, "q1", true);
        _destination2 = new AMQQueue(_connection, "q2", true);
        _session1 = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        _session1.createConsumer(_destination1).setMessageListener(new MessageListener()
            {
                public void onMessage(Message message)
                {
                    _log.debug("consumer 1 got message [" + getTextMessage(message) + "]");
                    synchronized (_received1)
                    {
                        _received1.add(message);
                        _received1.notify();
                    }
                }
            });
        _session2 = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        _session2.createConsumer(_destination2).setMessageListener(new MessageListener()
            {
                public void onMessage(Message message)
                {
                    _log.debug("consumer 2 got message [" + getTextMessage(message) + "]");
                    synchronized (_received2)
View Full Code Here

        }
        else
        {
            LOGGER.info("Consumer {} registering listener", getName());

            _jmsDelegate.registerListener(_command.getParticipantName(), new MessageListener(){

                @Override
                public void onMessage(Message message)
                {
                    processAsynchMessage(message);
View Full Code Here

   
        // Configure the components
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        container.addComponent("activemq", jmsComponentClientAcknowledge(connectionFactory));
        PojoComponent component = new PojoComponent();
        component.addService("listener", new MessageListener(){
      public void onMessage(Message msg) {
        System.out.println("Received: "+msg);
        receivedCountDown.countDown();       
      }
    });
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.