Upload
anirban-sen-chowdhary
View
116
Download
1
Embed Size (px)
Citation preview
Mule accessing Multiple database in parallel
By Anirban Sen Chowdhary
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.
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.
Let us consider we will retrieve data from 2 different databases :-• MSSql server• PostgresSQL
Let us first check our PostgresSQL database, we will find the following data in the table:-
Now, we will check our MSSQL Server database and find the following data in the table:-
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
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
Our Mule config will be:-
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:-
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:-
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
Thank You