Apache ActiveMQ 5.3-如何配置队列以拒绝重复消息? [英] Apache ActiveMQ 5.3 - How to configure a queue to reject duplicate messages?

查看:159
本文介绍了Apache ActiveMQ 5.3-如何配置队列以拒绝重复消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要队列来实施无重复策略。可能吗?如果是这样,怎么办?
(我已经搜索了几个小时...)

I need the queue to enforce no-duplicate policy. Is it possible? If so , how? (I've been googling for hours... )

编辑:

ActiveMQSession实现有以下几行:

The ActiveMQSession implementation has this lines:

        // transform to our own message format here
            ActiveMQMessage msg = ActiveMQMessageTransformation.transformMessage(message, connection);

        // Set the message id.
        if (msg == message) {
            msg.setMessageId(new MessageId(producer.getProducerInfo().getProducerId(), sequenceNumber));
        } else {
            msg.setMessageId(new MessageId(producer.getProducerInfo().getProducerId(), sequenceNumber));
            message.setJMSMessageID(msg.getMessageId().toString());
        }

ActiveMQMessageTransformation是可插入的(可以设置),但是以下if语句

The ActiveMQMessageTransformation is plugable (you can set it) , but the following if statement is a rather incontrovertible .

除了更改代码,还有什么主意吗?

Any ideas , except changing their code?

推荐答案

ActiveMQ内置了重复消息检测功能-您如何定义重复消息?如果重复的邮件具有相同的messageId-应该将其丢弃

ActiveMQ has duplicate message detection built in - how are you defining a duplicate ? If the duplicate has the same messageId - it should be discarded

这篇关于Apache ActiveMQ 5.3-如何配置队列以拒绝重复消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆