Scenario 13 - Integrate with Services via Connectors¶
This is a tutorial that is part of a series and can be used as a standalone tutorial on how to use connectors. For more details on the scenario and general prerequisites, please see the scenario overview page.
Time to Complete : 10 minutes
User story¶
RailCo is maintaining a Railway yard for their routine maintenance checkups for their trains. When a train comes into the yard, an entry file is created in CSV format. RailCo wants to generate an email out of this file, and they are planning to use Micro Integrator and its Email connector to achieve this.
When you integrate the systems in your organization, it is also necessary to integrate with third-party systems and its capabilities to enhance your services. WSO2 Micro Integrator uses Connectors for the purpose of referring to the APIs of third-party systems.
To develop the service you can use Integration Studio, where you can import and package the connector with the Composite application. To listen for a file, you can use an Inbound Endpoint, which will be listening to a particular location which you provide. Once a file is added to that location it will pick up the file and process it. Inbound Endpoints support various protocols such as HTTP, JMS, RabbitMQ, WebSocket etc,
While developing you can try it out in the Embedded Micro Integrator inside the Studio. Once the development is complete you can export it as a Compose Application and add it to the Micro Integrator runtime.
Step 1: Create and setup the service¶
Here, for simplicity, the service is already created and exported as a Composite Application along with the connector. Before adding the service to the system, you need to do the following.
- Create a temporary directory in your machine and create three sub directories inside it called in, out, and error.
-
Uncomment the volume section under mi-runtime in docker-compose.yml and provide the temporary directory location replacing the
<SourceLocation>
tag. -
To send the email, you need to have a SMTP server.
Uncomment the following environment variables under
_mi-runtime_
and fill in the details. -
After that, you need to add the
EmailService
CApp to the Micro Integrator in the setup. To do that uncomment the following line in the Dockerfile found inside<REPO_HOME>/dockerfiles/micro-integrator/
. -
Now you can restart the Micro Integrator.
docker-compose up -d --build mi-runtime
-
Once restarted, you can place the .csv file into the
**in
** directory inside your temporary location. You can use thetrain-entry-sample.csv
file found inside<REPO_HOME>/resources
directory for this purpose.Once added, the file will be picked by Micro Integrator and sent as an Email to the address that is configured above.
What's next¶
Try out the next scenario in the series, External Key Manager Support.