I have this simple REST service running in our JBoss app server which works great. For now, the service has one @GET method (getAllPeople), which makes a JDBC connection to a mysql database, to retrieve some data (SELECT name, address FROM Person).
My team lead wants me to experiment with Mule ESB, and use this simple project as a starting point. I'm confused on how to make this work with a Mule flow. I set up my flow with an HTTP inbound point, REST component, and JDBC component, like this:
I configured the JDBC component to use MySQL, and added a query to it (SELECT name, address FROM Person).
The question: The code in my REST service @GET method is still connecting directly to the DB with JDBC. I think I need to change this to instead, invoke the Mule JDBC datasource instead, but I have no idea how to do this. What code do I need to put in my REST service @GET method to utilize the Mule JDBC component, and get a result? I am trying to get a grasp on how the components talk to each other.
EDIT: new thought - Should an ESB be used to link different components of a single system together, such as REST services, SOAP services, and JDBC data sources, or should an ESB be used only to connect completely independent systems together?