重试过期后如何从 JBoss 4.2.2 消息队列重新发送消息

发布于 2024-07-21 07:47:43 字数 142 浏览 12 评论 0原文

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

在 JBoss 3 中,它们只是您可以移动的文本文件。 现在它已经存储在数据库中了,你该怎么做呢?

Is there a way to resend expired messages in a JBoss 4.2.2 message queue? The issue is they exceeded their retry amounts, but now the problem is fixed, so is there a way to resend them?

In JBoss 3 they were just text files that you could move around. Now that it is stored in a database, how can you do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦开始←不甜 2024-07-28 07:47:43

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

Have a look at Hermes JMS. It's an open source tool for browsing JMS queues and topics. It can replay messages that end up on the broker's undeliverable queue.

万水千山粽是情ミ 2024-07-28 07:47:43

这就是我最终所做的:

    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();

This is what I ended up doing:

    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();
失退 2024-07-28 07:47:43

注意:我在 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 了解更多详情。

Note: I work for CodeStreet

Our 'ReplayService for JMS' product is built exactly for this use case: search and retrieve previously published messages (n-times delivery) - JMS is really designed for a 1-time delivery.

With ReplayService for JMS, you would configure a WebLogic recording to record all messages published to your topic or queue. Through a Web-based GUI, you can then search for individual messages (by substring, XPath or JMS Selector) and then replay them again to the original JMS destination.

See http://www.codestreet.com/marketdata/jms/jms_details.php for further details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文