Hi

Since you use the polling consumer api directly, and not a route etc.
You would need to done the UoW on the exchange when you are done
processing it.

  while (exchange != null) {
                process(exchange);

                // must done the UoW after processing
                exchange.getUnitOfWork().done(exchange);

                exchange = pollingConsumer.receive(6000);
            }

On Thu, Sep 18, 2014 at 7:52 AM, Benoy Prakash <[email protected]> wrote:
> I am reading all mails from my inbox using Apache camel, with endpoint option
> peek=false.
> And process its attachments, according to our business logic. If my business
> logic fails, then i need to make the mail to be "marked as unread", if the
> processing is success, then "mark as read".
>
>
>             CamelContext context = new DefaultCamelContext();
>
>             Endpoint endpoint =
>                     context.getEndpoint("imaps://imap.gmail.com?username="
>                             + mailId
>                             + "&password="
>                             + password
>                             +
> "&delete=false&peek=false&unseen=true&consumer.delay=60000&closeFolder=false&disconnect=false");
>
>             pollingConsumer = endpoint.createPollingConsumer();
>             pollingConsumer.start();
>
>             pollingConsumer.getEndpoint().createExchange();
>
>             Exchange exchange = pollingConsumer.receive(6000);
>
>             while (exchange != null) {
>                 process(exchange);
>                 exchange = pollingConsumer.receive(6000);
>             }
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Mail-marking-as-read-and-unread-tp5756669.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to