【问题标题】:How to resend a message from the JBoss 4.2.2 message queue after retry expired重试过期后如何从 JBoss 4.2.2 消息队列重新发送消息
【发布时间】:2014-09-05 23:22:15
【问题描述】:

有没有办法在 JBoss 4.2.2 消息队列中重新发送过期消息?问题是他们超过了他们的重试数量,但现在问题已经解决了,那么有没有办法重新发送他们?

在 JBoss 3 中,它们只是可以移动的文本文件。既然已经存入数据库了,那怎么办呢?

【问题讨论】:

    标签: jboss jms jbossmq


    【解决方案1】:

    看看Hermes JMS。它是一个用于浏览 JMS 队列和主题的开源工具。它可以重播最终在代理的无法投递队列中的消息。

    【讨论】:

      【解决方案2】:

      这就是我最终做的:

          Hashtable t = new Hashtable();
          t.put(Context.PROVIDER_URL, "localhost:1099");
          t.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
          Context ctx = new InitialContext(t);
          Queue q = (Queue) ctx.lookup("/queue/DLQ");
          //----------------------------
          ConnectionFactory cf = (ConnectionFactory) ctx.lookup("/ConnectionFactory");
          Connection connection = cf.createConnection();
          Session session = connection.createSession(true, 0);
          //---------------------------------
          MessageConsumer consumer = session.createConsumer(q);
          connection.start();
          SpyObjectMessage m;
      
          Queue originialDestination = null;
      //There can only be one in my case, but really you have to look it up every time.
          MessageProducer producer = null;
          while ((m = (SpyObjectMessage) consumer.receive(5000)) != null) {
              Object o = m.getObject();
              Date messageDate = new Date(m.getJMSTimestamp());
              String originalQueue = m.getStringProperty("JBOSS_ORIG_DESTINATION");
                  if (originialDestination == null) {
                      originialDestination = (Queue) ctx.lookup("/queue/" +
       originalQueue.substring(originalQueue.indexOf('.') + 1));
                      producer = session.createProducer(originialDestination);
                  }
                  producer.send(session.createObjectMessage((Serializable) o));
            m.acknowledge();
          }
          //session.commit();    //Uncomment to make this real.
          connection.close();
          ctx.close();
      

      【讨论】:

        【解决方案3】:

        注意:我在 CodeStreet 工作

        我们的“ReplayService for JMS”产品正是为这个用例而构建的:搜索和检索以前发布的消息(n 次传递)- JMS 真的是为 1 次传递而设计的。

        使用 ReplayService for JMS,您可以配置 WebLogic 记录来记录发布到您的主题或队列的所有消息。通过基于 Web 的 GUI,您可以搜索单个消息(通过子字符串、XPath 或 JMS 选择器),然后再次将它们重播到原始 JMS 目标。

        更多详情请参阅http://www.codestreet.com/marketdata/jms/jms_details.php

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-03-12
          • 2022-12-13
          • 1970-01-01
          • 2013-01-16
          • 1970-01-01
          • 2016-07-18
          相关资源
          最近更新 更多