Four Stars

Camel route based on SMTP Consumer

Hi All
I would like to implement the following ESB Route to avoid messages loss when our MS Exchange server fails :

Current flow is :
App_1 App_2 App_3
| | |
| | |
\ | /
\ | /
\ | /
\ | /
\ | /
SMTP Exchange Sever -------> Gateway

New flow could be :
App_1 App_2 App_3
| | |
| | |
\ | /
\ | /
\ | /
\ | /
\ | /
Camel SMTP -------> Camel SMTP Producer -------> Gateway
Consumer to Exchange Sever
|
|
| On Failure
|
V
JMS Q
Emails_to_redeliver

.. with another dedicated route to listen the DLQ to re-send the un-sent elements.
I didn't found such camel component, did someone already have to implement such a flow ?
5 REPLIES
One Star

Re: Camel route based on SMTP Consumer

Hi,
you are right, Camel has no out-of-box component acting as an SMTP server.
From the architectural point of view - you are creating just another store and forward mail server (which becomes another SPOF), not solving anything.
If reliable delivery is needed, usually it's achieved by Apps sending an MQ (JMS) message
App1 \
App2 --> JMS route -> Camel-> SMTP
As you use off-shelf applications, usually the applications send emails, so you cannot us the approach above.
If you have problems with your Exchange gateway availability and HA clustering is not an option (out of control, too expensive, ..), then IMHO a local forwarding SMTP server would be simpler and easier to deploy than to develop and maintain a custom Camel based component.
Have fun
G.
Four Stars

Re: Camel route based on SMTP Consumer

Hi Gabriel,
many thanks for your reply.
In fact our ESB is HA (karaf & ActiveMQ in cluster), that's why I was considering a Camel SMTP forwarding rather as an HA feature than as a new SPOF.
I just found this custom camel component : https://code.google.com/p/camel-smtp/
I'll see next week if I could design a route to test it
Four Stars

Re: Camel route based on SMTP Consumer

HELP !
My first try is not working, I guess I missed something. Here are the steps that led me to this issue :
1. Building the jar from http://camel-smtp.googlecode.com/svn/trunk/ camel-smtp-read-only with maven
2. Including the jar in my route as a custom component in a cMessagingEndpoint
3. Connecting the consumer to a cJMS endpoint
4. Lauching the route... several dependencies missing, adding a cConfig with some jars to fix that
5. Launching again, and now getting a nice red stack trace talking about a lack of main() in one of the dependencies..
Does anyone have an idea to get out of this ?
Four Stars

Re: Camel route based on SMTP Consumer

Hi all,
here is an extract from the documentation of the component :
camel-smtp is a camel component which acts as consumer by accepting messages via smtp and forward them to a camel route.
= Configuration=
To use it just add this to your camel route:
from("smtp:*bindIp*:*bindPort*").to("endpoint");
Where *bindIp* is the ipaddress and *bindPort* is the port which are used to bind the server.

I'm don't know enough java & camel to make this route working but if someone is interested in such a case, everything is in the camel-smtp.rar attached, including sources. Let me know ...
oops only images are supported, elements are there : http://www.filedropper.com/camel-smtp
One Star

Re: Camel route based on SMTP Consumer

Hi,
I won't have a deeper look soon, just maybe an idea. The Camel framework builds the components endpoints based on their URL protocol (http://., file://, smtp:// imap:// ). The default camel distribution already contains an SMTP component to send emails (not to receive). In case you deploy both features, the result may get unpredictable.
However - if you intend to process emails (or forward) without managing the storage, it may be an interesting component.
Have fun
Gabriel