Package javax.jms

Examples of javax.jms.Session.createObjectMessage()


        InputStream zipStream) throws Exception {
        authorizeOrFail(subject, resourceId, "Can not update drifts");
        Connection connection = factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(fileQueue);
        ObjectMessage msg = session.createObjectMessage(new DriftUploadRequest(resourceId, driftDefName, token,
            zipSize, zipStream));
        producer.send(msg);
        connection.close();
    }
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 map = new HashMap();
        ObjectMessage message = publisherSession.createObjectMessage();
        for (int i = 0;i < COUNT;i++) {
            map.put(VALUE_NAME, new Integer(i));
            message.setObject(map);
            producer.send(message);
            assertTrue(message.getObject()==map);
View Full Code Here

        MessageConsumer consumer = session.createConsumer(destination);
        MessageProducer producer = session.createProducer(destination);
       
        // send the message.
        {
            ObjectMessage message = session.createObjectMessage();
            message.setObject("Hi");
            producer.send(message);
        }
       
        // Check the message
View Full Code Here

     * an ObjectMessage.
     */
    public void testConvertsMapWithSerializableValueIntoObjectMessage() throws Exception
    {
        Session session = mock(Session.class);
        when(session.createObjectMessage()).thenReturn(new ActiveMQObjectMessage());

        // Creates a test Map containing a serializable object
        Map data = new HashMap();
        data.put("orange", new Orange());

View Full Code Here

     * value throws an exception.
     */
    public void testConvertingMapIncludingNotValidNotSerializableValueThrowsException() throws Exception
    {
        Session session = mock(Session.class);
        when(session.createObjectMessage()).thenReturn(new ActiveMQObjectMessage());

        // Creates a test Map containing a non serializable object
        Map data = new HashMap();
        data.put("notserializable", new BananaFactory());

View Full Code Here

    }

    public void testConvertingSerializableToObjectMessage() throws JMSException
    {
        Session session = mock(Session.class);
        when(session.createObjectMessage()).thenReturn(new ActiveMQObjectMessage());

        final String OBJECT_ID = "id1234";
        ObjectMessage message = (ObjectMessage) JmsMessageUtils.toMessage(new SerializableObject(OBJECT_ID),
            session);
View Full Code Here

  }

  private ObjectMessage createObjectMessage() throws JMSException {

    final Session sendSession = this.getSendSession();
    ObjectMessage msg = sendSession.createObjectMessage();

    return msg;
  }

  /**
 
View Full Code Here

            }
        }
      Connection connection = connectionFactory.createConnection();
      try {
        Session session = connection.createSession(transacted, transacted ? Session.SESSION_TRANSACTED : Session.AUTO_ACKNOWLEDGE);
        ObjectMessage msg = session.createObjectMessage(object);
        MessageProducer producer = session.createProducer(dest);
        producer.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
        producer.send(msg);
      } finally {
        connection.close();
View Full Code Here

        JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623");
        Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer p = session.createProducer(rf.lookupDestination(destName));
        rf.getConnection().start();
        session.run();
        p.send(session.createObjectMessage((Serializable)payload));
        rf.closeConnection();
    }
}
View Full Code Here

        JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623");
        Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer p = session.createProducer(rf.lookupDestination(destName));
        rf.getConnection().start();
        session.run();
        p.send(session.createObjectMessage((Serializable)payload));
        rf.closeConnection();
    }
}
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.