Hi Charles,

I did not know about this idempotentConsumer, thanks for that.

I wonder if it pays off in my case though, as I have to query the repository
table so I can select things to send out based on what has already been
sent.

I have done that for now, which I think suffice for my needs:

        @Override
        protected int poll() throws Exception {
                final int numberOfMessagesPolled = 1;
                final Exchange exchange = endpoint.createExchange();
                final MapObject mapObject = 
mapRepository.pollNextObject(exchange
                                .getIn());
                try {
                        getProcessor().process(exchange);
                        mapRepository.logMessageProcessed(mapObject);
                        return numberOfMessagesPolled;
                } finally {
                        if (exchange.getException() != null) {
                                getExceptionHandler().handleException(
                                                "Error processing exchange", 
exchange,
                                                exchange.getException());
                        }
                }
        }

if getProcessor().process(exchange); fails, then I won't log the message as
being sent. On the other hand if the message is processed, then it is safe
to store the value.

Chances that the exchange fails after that are small, but existing, so
probably I have to upgrade my solution to the idempotentConsumer, solely for
having this transactional behaviour...




--
View this message in context: 
http://camel.465427.n5.nabble.com/Transaction-design-for-a-custom-compononent-tp5718361p5718392.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to