<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

    package org.abin.lee.activemq;

    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.DeliveryMode;
    import javax.jms.Destination;
    import javax.jms.MapMessage;
    import javax.jms.MessageProducer;
    import javax.jms.Session;

    import org.apache.activemq.ActiveMQConnection;
    import org.apache.activemq.ActiveMQConnectionFactory;

    public class MapSender {

     private static final int SEND_NUMBER = 5;

     public static void main(String[] args) {
      ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
        ActiveMQConnection.DEFAULT_USER,
        ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616");
      Connection connection = null;
      Session session;
      Destination destination = null;
      MessageProducer messageProducer;
      try {
       connection=connectionFactory.createConnection();
       connection.start();
       session=connection.createSession(Boolean.TRUE, Session.AUTO_ACKNOWLEDGE);
       destination=session.createQueue("FirstQueue");
       messageProducer=session.createProducer(destination);
       messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
       
       MapMessage map=session.createMapMessage();
       map.setBoolean("flag", true);
       map.setDouble("dou", 1.01);
       map.setInt("zx", 88);
       map.setString("zifu", "zzzzzz");
       messageProducer.send(map);
       session.commit();
      } catch (Exception e) {
       e.printStackTrace();
      }
     }


    }






    package org.abin.lee.activemq;

    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.MapMessage;
    import javax.jms.MessageConsumer;
    import javax.jms.Session;

    import org.apache.activemq.ActiveMQConnection;
    import org.apache.activemq.ActiveMQConnectionFactory;

    public class MapReceiver {public static void main(String[] args) {
     ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
       ActiveMQConnection.DEFAULT_USER,
       ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616");
     Connection connection = null;
     Session session;
     Destination destination;
     MessageConsumer consumer;
     try {
      connection = connectionFactory.createConnection();
      connection.start();
      session = connection.createSession(Boolean.FALSE,
        Session.AUTO_ACKNOWLEDGE);
      destination = session.createQueue("FirstQueue");
      consumer = session.createConsumer(destination);
      while(true){
       MapMessage map=(MapMessage)consumer.receive(500000);
       if (null != map) {
        boolean flag=map.getBoolean("falg");
        System.out.println("AcitveMQ 接收到的消息  flag="+flag);
        double dou=map.getDouble("dou");
        System.out.println("AcitveMQ 接收到的消息  dou="+dou);
        int zx=map.getInt("zx");
        System.out.println("AcitveMQ 接收到的消息  zx="+zx);
        String zifu=map.getString("zifu");
        System.out.println("AcitveMQ 接收到的消息  zifu="+zifu);
       }else
        break;

      }
      
       

     } catch (Exception e) {
      e.printStackTrace();
     }

    }
    }

    posted on 2012-08-02 16:35 abin 閱讀(872) 評論(0)  編輯  收藏 所屬分類: ActiveMQ
    主站蜘蛛池模板: 亚洲国产成人久久精品99| 女人裸身j部免费视频无遮挡| 亚洲午夜精品久久久久久浪潮| 亚洲一级毛片免费在线观看| 皇色在线免费视频| 国产AV日韩A∨亚洲AV电影| 国产成人精品日本亚洲11| 亚洲第一视频网站| 亚洲精品国偷自产在线| 亚洲电影日韩精品| 日本一道在线日本一道高清不卡免费 | 亚洲成人网在线观看| 亚洲av最新在线网址| 国产亚洲精品高清在线| 亚洲国产黄在线观看| 国产一级一片免费播放i| 免费毛片在线视频| 人禽杂交18禁网站免费| 国内精自视频品线六区免费| 6080午夜一级毛片免费看 | 国产成人高清亚洲| 亚洲国产精品成人| 亚洲女同成人AⅤ人片在线观看| 四虎国产精品免费久久影院| 小小影视日本动漫观看免费| 韩国欧洲一级毛片免费| 女人毛片a级大学毛片免费| 精品久久久久国产免费| 好男人视频在线观看免费看片| 成人免费毛片内射美女-百度| 久久精品免费一区二区| 在线观看H网址免费入口| 免费99精品国产自在现线| 99热在线精品免费全部my| 亚洲精品动漫免费二区| 成年女人毛片免费观看97| 成人免费看黄20分钟| 国产成人免费网站在线观看 | 三级片免费观看久久| 人成电影网在线观看免费| 国产一级一毛免费黄片|