【问题标题】:How to clear the JMS queue in Jboss如何在 Jboss 中清除 JMS 队列
【发布时间】:2012-03-02 17:37:33
【问题描述】:

我在 Jboss 中有一个 JMS 队列,该队列有一个消息选择器,例如“UseId = myname”。 myname 是不同用户的 ID。 当 UseId 等于 0001 时,如何清除队列中的消息?

【问题讨论】:

    标签: jboss jms message-queue


    【解决方案1】:

    试试这样的:

    String name = "0001"; // or whatever
    
    Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer mc = sess.createConsumer(queue, "UseId=" + name);
    
    while (mc.receive(100L) != null)
        ;
    
    sess.close();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-26
      • 1970-01-01
      • 1970-01-01
      • 2011-12-17
      • 2014-03-16
      • 2014-12-23
      相关资源
      最近更新 更多