camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Whytock <dwhyt...@gmail.com>
Subject Re: Maximum Number of Routes
Date Thu, 30 Jun 2011 21:01:08 GMT
Close.  More specifically, I mean the entire route can be shared...you
really should only need one route.

I assume you have a list of regexes and email addresses in a database?
 So for any given message, you compare it against the regexes and kick
off an email message for each match.

So your processor's constructor gets an endpoint for your SMTP server,
and from that gets a default producer.  Your processor's process()
does the database check, and for each hit cranks out a new exchange,
uses exchange.getIn().setHeader("to", emailaddress), generates the
appropriate text in exchange.getIn().setBody(), and sends it off.

Your one route consumes all the MQ exchanges.  No dynamic routing,
just dynamic exchange creation.

Sound like what you need?

Don


On Thu, Jun 30, 2011 at 4:44 PM, krishy <calvinkrishy@gmail.com> wrote:
>
> Donald Whytock wrote:
>>
>> You can do it with a single email endpoint that points to your SMTP
>> server, producing an exchange for each event for each user by putting
>> the destination email address in the message's "to" header.
>>
>
> Thanks and that is what I have planned. When ever the users informs their
> intent to watch an product the
> something like the following piece of code executes. Is this what you talk
> about when you say the end
>  point can be shared?
>
> void addRoutes(String selectorString, User user) throws Exception {
>      context.addRoutes(new RouteBuilder() {
>            from("activemq:topic:product?selector=" + selectorString).
>            .process(&lt;Sets the exchange with the message and to
> address&gt;)
>
> .to("smtp://mycompany.mailserver:30?password=tiger&username=scott");
>      });
> }
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Maximum-Number-of-Routes-tp4539803p4540083.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
View raw message