Package javax.jms

Examples of javax.jms.Session.createBytesMessage()


                Connection connection = factory.createConnection();
                connections.add(connection);
                Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                MessageProducer producer = session.createProducer(destination);
                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                BytesMessage message = session.createBytesMessage();
                message.writeBytes(new byte[1024]);
                connection.start();
                connectionsEstablished.release();

                while (!sampleTimeDone.await(0, TimeUnit.MILLISECONDS)) {
View Full Code Here


       
        MessageProducer queueProducer = ssn.createProducer(new AMQAnyDestination("ADDR:amq.direct"));
        MessageProducer topicProducer1 = ssn.createProducer(new AMQAnyDestination("ADDR:amq.topic/usa.weather"));
        MessageProducer topicProducer2 = ssn.createProducer(new AMQAnyDestination("ADDR:amq.topic/sales"));
       
        queueProducer.send(ssn.createBytesMessage());
        assertNotNull("The consumer subscribed to amq.direct " +
            "with empty binding key should have received the message ",queueCons.receive(1000));
       
        topicProducer1.send(ssn.createTextMessage("25c"));
        assertEquals("The consumer subscribed to amq.topic " +
View Full Code Here

    }

    public void testConvertingByteArrayToBytesMessage() throws JMSException
    {
        Session session = mock(Session.class);
        when(session.createBytesMessage()).thenReturn(new ActiveMQBytesMessage());

        byte[] bytesArray = new byte[]{1, 2};
        BytesMessage message = (BytesMessage) JmsMessageUtils.toMessage(bytesArray, session);

        // Makes the message readable
View Full Code Here

      content[i] = (byte) (i & 0xFF);
   
    long dtx = 0;
    long start = System.currentTimeMillis();
    for (int i=0; i<(Round*NbMsgPerRound); i++) {
      BytesMessage msg = session.createBytesMessage();
      if (SwapAllowed) {
        msg.setBooleanProperty("JMS_JORAM_SWAPALLOWED", true);
      }
      msg.writeBytes(content);
      msg.setLongProperty("time", System.currentTimeMillis());
View Full Code Here

                    MessageConsumer msgCon = ssn.createConsumer(dest);
                    msgCons[i] = msgCon;
                    MessageProducer msgProd = ssn.createProducer(dest);
                    msgProds[i] = msgProd;

                    BytesMessage msg = ssn.createBytesMessage();
                    msg.writeBytes("Test Msg".getBytes());

                    for (int j = 0; j < msg_count;j++)
                    {
                        msgProd.send(msg);
View Full Code Here

        MockControl messageControl = MockControl.createControl(BytesMessage.class);
        BytesMessage message = (BytesMessage) messageControl.getMock();

        byte[] content = new byte[5000];

        session.createBytesMessage();
        sessionControl.setReturnValue(message, 1);
        message.writeBytes(content);
        messageControl.setVoidCallable(1);
        message.readBytes(new byte[SimpleMessageConverter102.BUFFER_SIZE]);
        messageControl.setMatcher(new ArgumentsMatcher() {
View Full Code Here

        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

    }

    public void testCreateBytesMessage() throws Exception
    {
        Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
        assertNotNull(session.createBytesMessage());
        session.close();
       
        if (lastConnectionFailure != null)
            fail(lastConnectionFailure.toString());
    }
View Full Code Here

        BytesMessage msg;
        MessageProducer producer;
        MessageConsumer consumer;

        session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
        msg = session.createBytesMessage();
       
        byte[] data = new byte[1024];
        for(int n=0;n<data.length;n++)
          data[n] = (byte)n;
       
View Full Code Here

        MessageProducer producer = session.createProducer(queue);
        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

        byte[] data = new byte[dataSize];
        for (int i = 0; i < count; i++) {
            BytesMessage message = session.createBytesMessage();
            message.writeBytes(data);
            message.setIntProperty("c", i);
            producer.send(message);
            list.add(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.