You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ketan Barapatre <ke...@gmail.com> on 2012/02/24 05:56:26 UTC

How can I filter message

Hello All,

I am reading mail using IMAP.

public class MailRouteBuilder extends RouteBuilder {

public void configure() throws Exception {

from("imaps://imap.gmail.com?username=username&password=password
 &delete=false&unseen=true&consumer.delay=100").process(new
MailProcessor());
}

}

public class MailProcessor implements org.apache.camel.Processor {

public void process(Exchange exchange) throws Exception {

           // I'm receiving message/mail here

   Message message = exchange.getIn();
 }

}


When I'm receiving mail I need to filter mail according to

1. To date and From date
2. Subject
3. Sender

So that In my process method I will receive only filtered mails.

For this I read Interceptors and Message Filters but did not understand it
well.

Please guide me How can I filter mails ?

-- 

Regards
Ketan Barapatre

Re: How can I filter message

Posted by Christian Müller <ch...@gmail.com>.
Good to know you got it working. Further more fun by riding the Camel...

Best,
Christian

Sent from a mobile device
Am 24.02.2012 20:24 schrieb "Ketan Barapatre" <ke...@gmail.com>:

> It worked. ......
>
> Great .
>
> On Fri, Feb 24, 2012 at 11:37 PM, Ketan Barapatre
> <ke...@gmail.com>wrote:
>
> > Thank You.
> >
> > I'll try this.
> >
> > On Fri, Feb 24, 2012 at 2:24 PM, Christian Müller <
> > christian.mueller@gmail.com> wrote:
> >
> >> Your solution could look like this:
> >>
> >> Predicate predicate = new Predicate() {
> >>    @Override
> >>    public boolean matches(Exchange exchange) {
> >>        // your filter logic
> >>        return true/false;
> >>    }
> >> };
> >>
> >> from("xxx")
> >>    .filter(predicate)
> >>    .to("yyy");
> >>
> >> Best,
> >> Christian
> >>
> >> On Fri, Feb 24, 2012 at 5:56 AM, Ketan Barapatre
> >> <ke...@gmail.com>wrote:
> >>
> >> > Hello All,
> >> >
> >> > I am reading mail using IMAP.
> >> >
> >> > public class MailRouteBuilder extends RouteBuilder {
> >> >
> >> > public void configure() throws Exception {
> >> >
> >> > from("imaps://imap.gmail.com?username=username&password=password
> >> >  &delete=false&unseen=true&consumer.delay=100").process(new
> >> > MailProcessor());
> >> > }
> >> >
> >> > }
> >> >
> >> > public class MailProcessor implements org.apache.camel.Processor {
> >> >
> >> > public void process(Exchange exchange) throws Exception {
> >> >
> >> >           // I'm receiving message/mail here
> >> >
> >> >   Message message = exchange.getIn();
> >> >  }
> >> >
> >> > }
> >> >
> >> >
> >> > When I'm receiving mail I need to filter mail according to
> >> >
> >> > 1. To date and From date
> >> > 2. Subject
> >> > 3. Sender
> >> >
> >> > So that In my process method I will receive only filtered mails.
> >> >
> >> > For this I read Interceptors and Message Filters but did not
> understand
> >> it
> >> > well.
> >> >
> >> > Please guide me How can I filter mails ?
> >> >
> >> > --
> >> >
> >> > Regards
> >> > Ketan Barapatre
> >> >
> >>
> >
> >
> >
> > --
> >
> > Regards
> > Ketan Barapatre
> >
> >
> >
>
>
> --
>
> Regards
> Ketan Barapatre
>

Re: How can I filter message

Posted by Ketan Barapatre <ke...@gmail.com>.
It worked. ......

Great .

On Fri, Feb 24, 2012 at 11:37 PM, Ketan Barapatre
<ke...@gmail.com>wrote:

> Thank You.
>
> I'll try this.
>
> On Fri, Feb 24, 2012 at 2:24 PM, Christian Müller <
> christian.mueller@gmail.com> wrote:
>
>> Your solution could look like this:
>>
>> Predicate predicate = new Predicate() {
>>    @Override
>>    public boolean matches(Exchange exchange) {
>>        // your filter logic
>>        return true/false;
>>    }
>> };
>>
>> from("xxx")
>>    .filter(predicate)
>>    .to("yyy");
>>
>> Best,
>> Christian
>>
>> On Fri, Feb 24, 2012 at 5:56 AM, Ketan Barapatre
>> <ke...@gmail.com>wrote:
>>
>> > Hello All,
>> >
>> > I am reading mail using IMAP.
>> >
>> > public class MailRouteBuilder extends RouteBuilder {
>> >
>> > public void configure() throws Exception {
>> >
>> > from("imaps://imap.gmail.com?username=username&password=password
>> >  &delete=false&unseen=true&consumer.delay=100").process(new
>> > MailProcessor());
>> > }
>> >
>> > }
>> >
>> > public class MailProcessor implements org.apache.camel.Processor {
>> >
>> > public void process(Exchange exchange) throws Exception {
>> >
>> >           // I'm receiving message/mail here
>> >
>> >   Message message = exchange.getIn();
>> >  }
>> >
>> > }
>> >
>> >
>> > When I'm receiving mail I need to filter mail according to
>> >
>> > 1. To date and From date
>> > 2. Subject
>> > 3. Sender
>> >
>> > So that In my process method I will receive only filtered mails.
>> >
>> > For this I read Interceptors and Message Filters but did not understand
>> it
>> > well.
>> >
>> > Please guide me How can I filter mails ?
>> >
>> > --
>> >
>> > Regards
>> > Ketan Barapatre
>> >
>>
>
>
>
> --
>
> Regards
> Ketan Barapatre
>
>
>


-- 

Regards
Ketan Barapatre

Re: How can I filter message

Posted by Ketan Barapatre <ke...@gmail.com>.
Thank You.

I'll try this.

On Fri, Feb 24, 2012 at 2:24 PM, Christian Müller <
christian.mueller@gmail.com> wrote:

> Your solution could look like this:
>
> Predicate predicate = new Predicate() {
>    @Override
>    public boolean matches(Exchange exchange) {
>        // your filter logic
>        return true/false;
>    }
> };
>
> from("xxx")
>    .filter(predicate)
>    .to("yyy");
>
> Best,
> Christian
>
> On Fri, Feb 24, 2012 at 5:56 AM, Ketan Barapatre
> <ke...@gmail.com>wrote:
>
> > Hello All,
> >
> > I am reading mail using IMAP.
> >
> > public class MailRouteBuilder extends RouteBuilder {
> >
> > public void configure() throws Exception {
> >
> > from("imaps://imap.gmail.com?username=username&password=password
> >  &delete=false&unseen=true&consumer.delay=100").process(new
> > MailProcessor());
> > }
> >
> > }
> >
> > public class MailProcessor implements org.apache.camel.Processor {
> >
> > public void process(Exchange exchange) throws Exception {
> >
> >           // I'm receiving message/mail here
> >
> >   Message message = exchange.getIn();
> >  }
> >
> > }
> >
> >
> > When I'm receiving mail I need to filter mail according to
> >
> > 1. To date and From date
> > 2. Subject
> > 3. Sender
> >
> > So that In my process method I will receive only filtered mails.
> >
> > For this I read Interceptors and Message Filters but did not understand
> it
> > well.
> >
> > Please guide me How can I filter mails ?
> >
> > --
> >
> > Regards
> > Ketan Barapatre
> >
>



-- 

Regards
Ketan Barapatre

Re: How can I filter message

Posted by Christian Müller <ch...@gmail.com>.
Your solution could look like this:

Predicate predicate = new Predicate() {
    @Override
    public boolean matches(Exchange exchange) {
        // your filter logic
        return true/false;
    }
};

from("xxx")
    .filter(predicate)
    .to("yyy");

Best,
Christian

On Fri, Feb 24, 2012 at 5:56 AM, Ketan Barapatre
<ke...@gmail.com>wrote:

> Hello All,
>
> I am reading mail using IMAP.
>
> public class MailRouteBuilder extends RouteBuilder {
>
> public void configure() throws Exception {
>
> from("imaps://imap.gmail.com?username=username&password=password
>  &delete=false&unseen=true&consumer.delay=100").process(new
> MailProcessor());
> }
>
> }
>
> public class MailProcessor implements org.apache.camel.Processor {
>
> public void process(Exchange exchange) throws Exception {
>
>           // I'm receiving message/mail here
>
>   Message message = exchange.getIn();
>  }
>
> }
>
>
> When I'm receiving mail I need to filter mail according to
>
> 1. To date and From date
> 2. Subject
> 3. Sender
>
> So that In my process method I will receive only filtered mails.
>
> For this I read Interceptors and Message Filters but did not understand it
> well.
>
> Please guide me How can I filter mails ?
>
> --
>
> Regards
> Ketan Barapatre
>