<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
    主站蜘蛛池模板: 国产精品自在自线免费观看| 亚洲国产成人精品青青草原| 久久亚洲中文字幕精品一区四 | 久久亚洲AV成人无码软件| 久久亚洲AV成人无码国产| 国产亚洲福利在线视频| 一个人晚上在线观看的免费视频| 国产免费无码AV片在线观看不卡| 97性无码区免费| 亚洲人成网站18禁止一区| 亚洲愉拍99热成人精品热久久| 亚洲理论片在线观看| 五月天婷婷免费视频| 91免费国产精品| 免费在线观看的黄色网址| 亚洲av中文无码乱人伦在线播放 | 亚洲国产高清人在线| 亚洲情A成黄在线观看动漫软件| 亚洲成a人无码亚洲成www牛牛 | 中国一级特黄高清免费的大片中国一级黄色片 | 亚洲精品私拍国产福利在线| 亚洲欧美成人一区二区三区| 久久精品免费一区二区三区| 青青青青青青久久久免费观看| 亚洲va无码va在线va天堂| 亚洲AV无码一区二区三区久久精品| 国产成年无码久久久免费| 日韩成人免费视频播放| 亚洲网站在线免费观看| 国产精品hd免费观看| 爽爽日本在线视频免费| 久久精品国产亚洲AV无码偷窥| 一区二区三区精品高清视频免费在线播放| 永久在线免费观看| 亚洲精品无码专区久久久| 精品女同一区二区三区免费播放| 四虎影视久久久免费观看| 成年女性特黄午夜视频免费看| 亚洲AV无码精品色午夜果冻不卡| 偷自拍亚洲视频在线观看99| 美女黄网站人色视频免费|