Package javax.jms

Examples of javax.jms.Session.createObjectMessage()


        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


        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

        // 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

        }

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

         * send the string representation of the value for the AbstractCacheElement in the JMS message
         */
        ActiveAlertConditionMessage conditionMessage = new ActiveAlertConditionMessage(alertConditionId, timestamp,
            value.toString(), extraParams);

        ObjectMessage message = session.createObjectMessage(conditionMessage);

        sender.send(message);

        connection.close();
    }
View Full Code Here

        MessageProducer sender = session.createProducer(alertConditionQueue);

        // missing "value" element in the message is a negative event
        InactiveAlertConditionMessage conditionMessage = new InactiveAlertConditionMessage(alertConditionId, timestamp);

        ObjectMessage message = session.createObjectMessage(conditionMessage);

        sender.send(message);

        connection.close();
    }
View Full Code Here

    public void addChangeSet(Subject subject, int resourceId, long zipSize, 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(changesetQueue);
        ObjectMessage msg = session.createObjectMessage(new DriftUploadRequest(resourceId, zipSize, zipStream));
        producer.send(msg);
        connection.close();
    }

    // use a new transaction when putting things on the JMS queue. see
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.