The sql binding in SwitchYard provides database read/write support for references in SwitchYard.
The file binding is built on top of camel-sql.
SQL Binding options
Following options can be apiled to <binding.sql> definition:
-
query : SQL query to execute
-
dataSourceRef : data source name
-
batch : turn on JDBC batching
-
placeholder : a placeholder sign used to replace parameters in query
For detailed description of these parameters please visit camel-sql site.
Binding Services with database
Two additional attributes may be specified for binding.sql element when used with service reference:
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
<sca:service name="GreetingService" promote="GreetingService">
<camel:binding.sql period="10s">
<camel:query>SELECT * FROM greetings</camel:query>
<camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef>
</camel:binding.sql>
</sca:service>
</sca:composite>
Binding References with database
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
<sca:reference name="GreetingDatabaseStore" promote="camel-binding/GreetingDatabaseStore" multiplicity="1..1">
<camel:binding.sql>
<camel:query>INSERT INTO greetings (name) VALUES (#)</camel:query>
<camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef>
<camel:binding.sql>
</sca:reference>
</sca:composite>