Examples of createBytesMessage()


Examples of javax.jms.Session.createBytesMessage()

        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
       
        MessageProducer producer = producerSession.createProducer(topic);
        producerConnection.start();
        for (int i = 0; i < COUNT; i++) {
            BytesMessage msg = producerSession.createBytesMessage();
            msg.writeBytes(payload);
            producer.send(msg);
            if (i != 0 && i % 1000 == 0) {
                LOG.info("Sent msg " + i);
            }
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

        MessageConsumer advisoryConsumer = session.createConsumer(advisoryTopic);
        MessageProducer producer = session.createProducer(queue);

        // send lots of messages to the tempQueue
        for (int i = 0; i < MESSAGE_COUNT; i++) {
            BytesMessage m = session.createBytesMessage();
            m.writeBytes(new byte[1024]);
            producer.send(m);
        }

        // consume one message from tempQueue
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

                for (int i = 0; i < numberOfMessages; i++) {
                    Session session = conn.createSession(false,Session.AUTO_ACKNOWLEDGE);
                    Destination destination = session.createQueue("test-queue");
                    MessageProducer producer = session.createProducer(destination);
                    producer.setDeliveryMode(DeliveryMode.PERSISTENT);
                    BytesMessage message = session.createBytesMessage();
                    message.writeBytes(bytes);
                    try {
                        producer.send(message);
                    } catch (ResourceAllocationException e) {
                        e.printStackTrace();
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

            ByteArrayOutputStream os = new ByteArrayOutputStream();
            message.save(os);
            os.close();
            byte[] bs = os.toByteArray();
           
            BytesMessage bytesMessage = session.createBytesMessage();
            bytesMessage.writeBytes(bs);
            producer.send(bytesMessage);
           
        } finally {
            session.close();
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

    public void notify(Topic topic, byte[] bytes) throws IOException, JMSException {
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            MessageProducer producer = session.createProducer(topic);

            BytesMessage bytesMessage = session.createBytesMessage();
            bytesMessage.writeBytes(bytes);
            producer.send(bytesMessage);

        } finally {
            session.close();
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

        connection.start();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(session.createQueue(QUEUE_NAME));
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
        for (int i = 0; i < MAX_MESSAGES; i++) {
            BytesMessage message = session.createBytesMessage();
            message.writeBytes(new byte[1000]);
            producer.send(message);
        }
        producer.close();
        session.close();
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

    private void sendTestBytesMessage(ActiveMQConnectionFactory factory, String message) throws JMSException, UnsupportedEncodingException {
        ActiveMQConnection connection = (ActiveMQConnection)factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(queue);
        BytesMessage bytesMessage = session.createBytesMessage();
        bytesMessage.writeBytes(message.getBytes("UTF8"));
        producer.send(bytesMessage);
        connection.close();
    }
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        destination = createDestination(session, destinationType);
        MessageConsumer consumer = session.createConsumer(destination);
        MessageProducer producer = session.createProducer(destination);

        BytesMessage message = session.createBytesMessage();
        message.writeBoolean(true);
        message.writeBoolean(false);
        producer.send(message);

        // Make sure only 1 message was delivered.
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = producerSession.createTopic(topicName);
        MessageProducer producer = producerSession.createProducer(topic);
        producerConnection.start();
        for (int i = 0; i < numMessages; i++) {
            BytesMessage msg = producerSession.createBytesMessage();
            msg.writeBytes(payload);
            producer.send(msg);
            if (i != 0 && i % 100 == 0) {
                LOG.info("Sent msg " + i);
            }
View Full Code Here

Examples of javax.jms.Session.createBytesMessage()

        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
       
        MessageProducer producer = producerSession.createProducer(topic);
        producerConnection.start();
        for (int i = 0; i < COUNT; i++) {
            BytesMessage msg = producerSession.createBytesMessage();
            msg.writeBytes(payload);
            producer.send(msg);
            if (i != 0 && i % 1000 == 0) {
                LOG.info("Sent msg " + i);
            }
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.