Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/Integration/Camel/Camel Route to Send and Receive Email

Objective

In this article we are going to explore usage of Camel route to send an email, pause process there and receive the reply to that email and continue.

For example, an employee fills in certain data and moves the process, the process in turn sends an email to given email ID for approval and pauses the process execution, once the process receives reply/approval to the same email, it resumes the process execution.

Approach

We will design a process with following activities: Enter Details - user will fill in certain details here including the email ID of the approver. Prepare Email Body - A script application activity which will create the body of the email out of data provided to it. Send And Wait Activity - which will send the email and get into hibernated mode. it will look up the email box of the configured user and once approval/reply mail arrives, it will complete itself and move the process. Show Response - A manual activity to show the received reply/approval email's body.

Create a process like shown below:

ProcessDiagram.jpg

Define 2 data types CEP Details and Employee Details as shown below:

DataTypes.jpg

Define 2 application Prepare Email Body (Script Invocation) and Send And Wait (Generic Camel Route):

PrepareMessage.jpg

SendandWait.jpg

Deploy the model. When you run the process instance, it will ask you to input details:

Complete the activity, it will call both the application activities, prepare email body and send and wait. During execution of send and wait the process instance will hibernate and wait for an approval email. once that arrives it will complete this hibernated activity and activate Show Response Data manual activity where you can see the response email message.

ExecutionResult.jpg

Back to the top