You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Benoy Prakash <be...@gmail.com> on 2014/09/18 07:52:56 UTC
Mail , marking as read and unread.
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.
Re: Mail , marking as read and unread.
Posted by Benoy Prakash <be...@gmail.com>.
Still my mail is "marked as read(seen)", when it failed do complete
the process(exchange); function.
Will " exchange.getUnitOfWork().done(exchange); " make a mail "marked as
unread" on a marked mail.
On Thu, Sep 18, 2014 at 11:29 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5756670h48@n5.nabble.com> wrote:
> 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 <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=5756670&i=0>> 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: [hidden email]
> <http://user/SendEmail.jtp?type=node&node=5756670&i=1>
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Mail-marking-as-read-and-unread-tp5756669p5756670.html
> To unsubscribe from Mail , marking as read and unread., click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5756669&code=YmVub3lwcmFrYXNoQGdtYWlsLmNvbXw1NzU2NjY5fC04NzgwMzIyOTg=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
*Benoy P P*,
0091-9846311443
Benoy Prakash on GMail <be...@gmail.com>
Benoy Prakash on Hotmail <be...@hotmail.com>
Benoy Prakash on Rediffmail <be...@rediffmail.com>
Benoy Prakash on Facebook <https://www.facebook.com/benoyvbs>
Benoy Prakash on Linked IN <http://in.linkedin.com/in/benoyprakash>
Benoy Prakash on Orkut
<http://www.orkut.co.in/Main#Profile?uid=5287360320692641746>
Benoy Prakash on Twitter <https://twitter.com/#%21/benoyprakash>
Benoy Prakash on G+ <https://plus.google.com/u/0/>
*Benoy Prakash's Blog <http://benoybinu.blogspot.in/>*
--
View this message in context: http://camel.465427.n5.nabble.com/Mail-marking-as-read-and-unread-tp5756669p5756672.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Mail , marking as read and unread.
Posted by Claus Ibsen <cl...@gmail.com>.
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 <be...@gmail.com> 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: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/