Package javax.jms

Examples of javax.jms.MapMessage


   }


   public void testCopyOnForeignMapMessage() throws JMSException
   {
      MapMessage foreignMapMessage = new SimpleJMSMapMessage();
      foreignMapMessage.setInt("int", 1);
      foreignMapMessage.setString("string", "test");

      JBossMapMessage copy = new JBossMapMessage(foreignMapMessage, 0);

      ensureEquivalent(foreignMapMessage, copy);
   }
View Full Code Here


                } catch (JMSException e) {
                }

                activeMessage = msg;
            } else if (message instanceof MapMessage) {
                MapMessage mapMsg = (MapMessage)message;
                ActiveMQMapMessage msg = new ActiveMQMapMessage();
                msg.setConnection(connection);
                Enumeration iter = mapMsg.getMapNames();

                while (iter.hasMoreElements()) {
                    String name = iter.nextElement().toString();
                    msg.setObject(name, mapMsg.getObject(name));
                }

                activeMessage = msg;
            } else if (message instanceof ObjectMessage) {
                ObjectMessage objMsg = (ObjectMessage)message;
View Full Code Here

        MessageConsumer consumer = session.createConsumer(destination);
        MessageProducer producer = session.createProducer(destination);

        // send the message.
        {
            MapMessage message = session.createMapMessage();
            message.setBoolean("boolKey", true);
            producer.send(message);
        }

        // get the message.
        {
            MapMessage message = (MapMessage)consumer.receive(1000);
            assertNotNull(message);
            assertTrue(message.getBoolean("boolKey"));
        }
        assertNull(consumer.receiveNoWait());
    }
View Full Code Here

                byte[] payload = context.getTypeConverter().convertTo(byte[].class, exchange, body);
                message.writeBytes(payload);
                return message;
            }
            case Map: {
                MapMessage message = session.createMapMessage();
                Map payload = context.getTypeConverter().convertTo(Map.class, exchange, body);
                populateMapMessage(message, payload, context);
                return message;
            }
            case Object:
View Full Code Here

        frame = "SEND\n" + "destination:/queue/" + getQueueName() + "\n" + "transformation:" + Stomp.Transformations.JMS_MAP_XML + "\n\n" + xmlMap + Stomp.NULL;

        stompConnection.sendFrame(frame);

        MapMessage message = (MapMessage) consumer.receive(1000);
        assertNotNull(message);
        assertEquals(message.getString("name"), "Dejan");
    }
View Full Code Here

        frame = "SEND\n" + "destination:/queue/" + getQueueName() + "\n" + "transformation:" + Stomp.Transformations.JMS_MAP_JSON + "\n\n" + jsonMap + Stomp.NULL;

        stompConnection.sendFrame(frame);

        MapMessage message = (MapMessage) consumer.receive(1000);
        assertNotNull(message);
        assertEquals(message.getString("name"), "Dejan");
    }
View Full Code Here

    }

    public void testTransformationReceiveXMLMap() throws Exception {

        MessageProducer producer = session.createProducer(new ActiveMQQueue("USERS." + getQueueName()));
        MapMessage message = session.createMapMessage();
        message.setString("name", "Dejan");
        message.setString("city", "Belgrade");
        producer.send(message);

        String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL;
        stompConnection.sendFrame(frame);
View Full Code Here

    }

    public void testTransformationReceiveJSONMap() throws Exception {

        MessageProducer producer = session.createProducer(new ActiveMQQueue("USERS." + getQueueName()));
        MapMessage message = session.createMapMessage();
        message.setString("name", "Dejan");
        message.setString("city", "Belgrade");
        producer.send(message);
     
        String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL;
        stompConnection.sendFrame(frame);
View Full Code Here

                Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createTopic(TOPIC_NAME);
        MessageConsumer consumer = session.createConsumer(destination);

        // wait till you get atleast one message
        MapMessage m;
        for (m = null; m == null;) {
            m = (MapMessage) consumer.receive();
        }
        System.out.println("Consumed: " + m.toString());
        assertMessage(m);
        Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                "/falcon/feed/agg-logs/path1/2010/10/10/20");

        for (m = null; m == null;) {
            m = (MapMessage) consumer.receive();
        }
        System.out.println("Consumed: " + m.toString());
        assertMessage(m);
        Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                "/falcon/feed/agg-logs/path1/2010/10/10/21");

        for (m = null; m == null;) {
            m = (MapMessage) consumer.receive();
        }
        System.out.println("Consumed: " + m.toString());
        assertMessage(m);
        Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                "/falcon/feed/agg-logs/path1/2010/10/10/22");

        for (m = null; m == null;) {
            m = (MapMessage) consumer.receive();
        }
        System.out.println("Consumed: " + m.toString());
        assertMessage(m);
        Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                "/falcon/feed/agg-logs/path1/2010/10/10/23");

        connection.close();
    }
View Full Code Here

        return;
      }
      MessageProducer producer = session.createProducer(topic);
      Message msg;
      if (msgBody instanceof Map){
        MapMessage mapMsg = session.createMapMessage();
        Map<String,String> incomingMap = (Map<String,String>)msgBody;
        for (Entry<String,String> partCol : incomingMap.entrySet()){
          mapMsg.setString(partCol.getKey(), partCol.getValue());
        }
        msg = mapMsg;
      }
      else {
        msg = session.createObjectMessage((Serializable)msgBody);
View Full Code Here

TOP

Related Classes of javax.jms.MapMessage

Copyright © 2018 www.massapicom. 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.