Package javax.jms

Examples of javax.jms.Session.createObjectMessage()


                // Wait for a message
                // Again this is quite inefficient
                consumer = tempSession.createConsumer(responseQueue);

                // Create a message
                final ObjectMessage requestMessage = tempSession.createObjectMessage();
                requestMessage.setJMSReplyTo(responseQueue);
                requestMessage.setJMSCorrelationID(correlationId);
                requestMessage.setObject((Serializable) request);

                // Send the request
View Full Code Here


                    response.put("exception", "true");
                }
                response.put("return", result);

                // create response message
                final ObjectMessage resMessage = session.createObjectMessage();
                resMessage.setJMSCorrelationID(message.getJMSCorrelationID());
                resMessage.setObject((Serializable) response);

                // send response message
                replyProducer.send(message.getJMSReplyTo(), resMessage);
View Full Code Here

      if (_log.isTraceEnabled())
      {
         _log.trace("createObjectMessage" + Util.asString(session));
      }

      return session.createObjectMessage();
   }

   /**
    * Create an object message
    * @param object The object
View Full Code Here

      if (_log.isTraceEnabled())
      {
         _log.trace("createObjectMessage(" + object + ")" + Util.asString(session));
      }

      return session.createObjectMessage(object);
   }

   /**
    * Create a stream message
    * @return The message
View Full Code Here

        Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = consumerSession.createConsumer(destination);
        Session publisherSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = publisherSession.createProducer(destination);
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        ObjectMessage message = publisherSession.createObjectMessage();
        for (int i = 0; i < COUNT; i++) {
            map.put(VALUE_NAME, Integer.valueOf(i));
            message.setObject(map);
            producer.send(message);
            assertTrue(message.getObject() == map);
View Full Code Here

                    factory.setCopyMessageOnSend(false);

                    Connection connection = factory.createConnection();
                Session session = (ActiveMQSession)connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                MessageProducer producer = session.createProducer(destination);
                    ActiveMQObjectMessage message = (ActiveMQObjectMessage)session.createObjectMessage();
                    message.setObject(obj);
                    producer.send(message);
                  producer.close();
                } catch (Throwable ex) {
                    exceptions.add(ex);
View Full Code Here

                    factory.setCopyMessageOnSend(false);

                    Connection connection = factory.createConnection();
                Session session = (ActiveMQSession)connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                MessageProducer producer = session.createProducer(destination);
                    ActiveMQObjectMessage message = (ActiveMQObjectMessage)session.createObjectMessage();
                    message.setObject(obj);
                    producer.send(message);
                  producer.close();
                } catch (Throwable ex) {
                    exceptions.add(ex);
View Full Code Here

        // send a message
        Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = producerSession.createProducer(destination);

        ObjectMessage request = producerSession.createObjectMessage(new SamplePojo("James", "London"));
        producer.send(request);

        // lets consume it as an object message
        Message message = objectConsumer.receive(timeout);
        assertNotNull("Should have received a message!", message);
View Full Code Here

        body = (SamplePojo)object;
        assertEquals("name", "James", body.getName());
        assertEquals("city", "London", body.getCity());

        // Send object message
        ObjectMessage objRequest = producerSession.createObjectMessage(new SamplePojo("James", "London"));
        producer.send(objRequest);

        // lets consume it as an object message
        message = adaptiveConsumer.receive(timeout);
        assertNotNull("Should have received a message!", message);
View Full Code Here

        body = (SamplePojo)object;
        assertEquals("name", "James", body.getName());
        assertEquals("city", "London", body.getCity());
       
        // Send object message
        ObjectMessage objRequest = producerSession.createObjectMessage(new SamplePojo("James", "London"));
        producer.send(objRequest);

        // lets consume it as an object message
        message = adaptiveConsumer.receive(timeout);
        assertNotNull("Should have received a message!", message);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.