JBoss Community Archive (Read Only)

SwitchYard 1.0

SQL

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:

  • period - number of milliseconds between query executions. This attribute is mandatory.

  • initialDelay - an delay before query is run first time

<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>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:54:43 UTC, last content change 2013-03-26 01:13:24 UTC.