<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 閱讀(877) 評論(0)  編輯  收藏 所屬分類: ActiveMQ
    主站蜘蛛池模板: 亚洲AV无码一区二区三区人| 久久精品国产96精品亚洲 | 亚洲裸男gv网站| 边摸边吃奶边做爽免费视频99| 国产美女精品视频免费观看| 亚洲AV无码一区二区大桥未久| 最近免费中文字幕4| 亚洲人片在线观看天堂无码| 女人张开腿给人桶免费视频| 亚洲精品宾馆在线精品酒店| 日本大片在线看黄a∨免费| 小说区亚洲自拍另类| 亚洲男人av香蕉爽爽爽爽| 久久免费观看视频| 亚洲激情在线观看| 免费能直接在线观看黄的视频| 亚洲综合偷自成人网第页色| 日本v片免费一区二区三区| 免费的黄色网页在线免费观看| 久久精品国产亚洲沈樵| 你懂的免费在线观看网站| 亚洲精品白色在线发布| 超pen个人视频国产免费观看| 怡红院亚洲红怡院在线观看| 亚洲日韩v无码中文字幕| 57pao国产成视频免费播放| 久久亚洲精品国产精品婷婷| 深夜国产福利99亚洲视频| 国偷自产一区二区免费视频| 亚洲国产日韩在线| 四虎影视永久免费观看网址| 99久久免费国产特黄| 亚洲午夜精品一区二区公牛电影院| 热久久精品免费视频| a级毛片毛片免费观看久潮喷| 亚洲制服在线观看| 久久国产成人亚洲精品影院| 免费福利视频导航| 高清免费久久午夜精品| 成熟女人牲交片免费观看视频| 免费福利在线观看|