Package javax.jms

Examples of javax.jms.Session.createObjectMessage()


    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);
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

        // Send a message to the work queue, and wait for the BATCH_SIZE acks
        // from the workers.
        acksReceived.set(0);
        latch.set(new CountDownLatch(BATCH_SIZE));
        workItemProducer.send(masterSession
                .createObjectMessage(new WorkMessage(1)));

        if (!latch.get().await(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
            fail("First batch only received " + acksReceived + " messages");
        }
View Full Code Here

        // at this point where the workers never get notified of this message, as they
        // have a large pending queue. Creating a new worker at this point however will
        // receive this new message.
        acksReceived.set(0);
        latch.set(new CountDownLatch(BATCH_SIZE));
        workItemProducer.send(masterSession
                .createObjectMessage(new WorkMessage(1)));

        if (!latch.get().await(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
            fail("Second batch only received " + acksReceived + " messages");
        }
View Full Code Here

    MessageConsumer consumer = session.createConsumer(destination);
    connection.start();

        MessageProducer producer = session.createProducer(destination);
        final MyObject obj = new MyObject("A message");
        ActiveMQObjectMessage m1 = (ActiveMQObjectMessage)session.createObjectMessage();
        m1.setObject(obj);
        producer.send(m1);

        ActiveMQTextMessage m2 = new ActiveMQTextMessage();
        m2.setText("Test Message Payload.");
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

            mm.setShort("short", (short)11);
            mm.setString("string", "this is a string");

            msgs.add(mm);
            msgs.add(sess.createTextMessage("hello" + i));
            msgs.add(sess.createObjectMessage(new SomeSerializable("hello" + i)));
         }

         internalTestResend(msgs, sess);

      }
View Full Code Here

        JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, "tcp://localhost:61618");
        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

        connection.start();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);

        // now lets send a message
        ObjectMessage message = session.createObjectMessage(expectedBody);
        message.setStringProperty("foo", "bar");
        producer.send(message);

        result.assertIsSatisfied();
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.