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
-
consume: define the consumer attributes. This is optional.
For detailed description of these parameters please visit camel-sql site.
Binding Services with database
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
<sca:service name="GreetingService" promote="GreetingService">
<camel:binding.sql>
<camel:query>SELECT * FROM greetings</camel:query>
<camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef>
<!--This is optional. If not defined the default camel values will be used.-->
<camel:consume>
<camel:initialDelay>1000</camel:initialDelay>
<camel:delay>500</camel:delay>
</camel:consume>
</camel:binding.sql>
</sca:service>
</sca:composite>
For being compatible with previous versions (although not recommended), it is allowed to include in the camel:binding.sql tag the attributes.
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>