camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chrajanirao <>
Subject Problem with IdempotentConsumer
Date Thu, 12 Mar 2009 00:44:59 GMT


Below is from of Camel 1.5:

public void process(Exchange exchange) throws Exception {
        String messageId =
ExpressionHelper.evaluateAsString(messageIdExpression, exchange);
        if (messageId == null) {
            throw new NoMessageIdException(exchange, messageIdExpression);
        if (!messageIdRepository.contains(messageId)) {
        } else {
            onDuplicateMessage(exchange, messageId);

The messageIdRepository.contains method is checking as well as adding the
messageId to repository if it doesn't exist already. I see this as a problem
because, before even processing message we are adding it to the repository,
how do we know if the process was successful or not? I mean in case of
failure to the process we would like to re-process the message when its
delivered again but since the repository already contains the messageId, how
do to determine whether to process it or not?

Wouldn't it be better to have "contains" and "addToRepository" as separate
operations and call addToRepository after nextProcessor.process. Another
option would be to mark initially as "Received" and after process as

Hope to get a reply/opinion from someone.
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message