13
Mule accessing Multiple database in parallel By Anirban Sen Chowdhary

Mule accessing multiple database in parallel

Embed Size (px)

Citation preview

Page 1: Mule accessing multiple database in parallel

Mule accessing Multiple database in parallel

By Anirban Sen Chowdhary

Page 2: Mule accessing multiple database in parallel

Mule Database connector has a very powerful feature of accessing Database.The Database connector allows you to connect with almost any Java Database Connectivity (JDBC) relational database .

In this demonstration we will see how to access 2 different databases of 2 different types in parallel.

Page 3: Mule accessing multiple database in parallel

To access to database at a same time in parallel we will use scatter-gather in our Mule flow.

The routing message processor Scatter-Gather will access multiple database concurrently. It collects the responses from all routes, and aggregates them into a single message.

Page 4: Mule accessing multiple database in parallel

Let us consider we will retrieve data from 2 different databases :-• MSSql server• PostgresSQL

Page 5: Mule accessing multiple database in parallel

Let us first check our PostgresSQL database, we will find the following data in the table:-

Page 6: Mule accessing multiple database in parallel

Now, we will check our MSSQL Server database and find the following data in the table:-

Page 7: Mule accessing multiple database in parallel

Now, we will retrieve the data from both the database in parallel … Here is our Mule flow:-

Here we can see that both the database flow are put into scatter-gather so that we can retrieve the data from both the Database concurrently

Page 8: Mule accessing multiple database in parallel

Here is our both the flow:-

Here we can see that both the database retrieve the data from it’s table concurrently and put the data into a logger

Page 9: Mule accessing multiple database in parallel

Our Mule config will be:-

Page 10: Mule accessing multiple database in parallel

So, to test the application if we hit the url http://localhost:8082/db we will get the following in the browser, a combined payload or rows from both the table:-

Page 11: Mule accessing multiple database in parallel

And in logger you can see that the Data has been retrieve from both the database table concurrently and displayed in the log as well as a combined payload of both the rows from both the table:-

Page 12: Mule accessing multiple database in parallel

In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow

Page 13: Mule accessing multiple database in parallel

Thank You