Reputation: 96
I have requirement for to fetch data from Database and expose the content as Restful service, I am unable to find any useful documents.
Can any one please share the documents or links.
Upvotes: 0
Views: 223
Reputation: 8311
A simple example will be :-
<flow name="testFlow">
<http:listener config-ref="HTTP_InboundRequest" path="/test" doc:name="HTTP"/>
<set-variable doc:name="Variable" value="23" variableName="eventId"/>
<db:select config-ref="Oracle_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select ID, NAME where EVENT_ID=#[flowVars['eventId']]]]></db:parameterized-query>
</db:select>
<set-payload value="{"status":"Success"}" doc:name="Set Payload"/>
</flow>
Where you can modify the code as per your requirement and display the Database values as JSON response. So, if you deploy a service similar to this , it will be exposed as a Rest api
Upvotes: 0
Reputation: 2319
Take a look at http://www.mulesoft.org/extensions/rest-module
You can combine it with JDBC endpoints to fetch data from the DB.
Upvotes: 2