Hello.
I made a few changes based on Guillaume suggestions, and it's working. This is the servicemix.xml, thank's both.

   Regards.

PS: Seems that Guillaume used a different sintaxis than mine.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:my="http://servicemix.org/demo/";
      xmlns:foo2="http://localhost/";>

 <!-- the JBI container -->
 <container id="jbi">
   <property name="rootDir" value="../wdir"/>
   <property name="createMBeanServer" value="true"/>
   <property name="installationDirPath" value="../install"/>
   <property name="monitorInstallationDirectory" value="true"/>
   <property name="dumpStats" value="true"/>
   <property name="statsInterval" value="10"/>
   <property name="transactionManager" ref="transactionManager"/>

   <components>

<!-- Create a http server binding on port 8912 --> <component id="httpReceiver1" service="foo:httpBinding1" endpoint="httpReceiver" class="org.servicemix.components.http.HttpConnector"
     destinationService="foo:xsqlGroovy">
       <property name="host" value="localhost"/>
       <property name="port" value="8912"/>
     </component>

<component id="httpReceiver2" service="foo:httpBinding2" endpoint="httpReceiver" class="org.servicemix.components.http.HttpConnector"
     destinationService="foo2:xsql">
       <property name="host" value="localhost"/>
       <property name="port" value="8913"/>
     </component>

     <!-- XSQL configuration -->
<component id="xsql" service="foo2:xsql" class="org.servicemix.components.xsql.XSQLComponent" >
       <property name="connectionManagerFactory">
<bean class="org.servicemix.components.xsql.DataSourceXSQLConnectionManagerFactory">
           <property name="dataSource" ref="mysql-prueba"/>
         </bean>
       </property>
     </component>

   <!-- JB Groovy component -->
<component id="xsqlGroovy" service="foo:xsqlGroovy" class="org.servicemix.components.groovy.GroovyComponent"
     destinationService="foo:xsql" >
     <property name="scriptText">
       <value>
         <![CDATA[

def mess1 = deliveryChannel.createExchangeFactoryForService(new javax.xml.namespace.QName("http://localhost/","xsql";)).createInOutExchange()
def inMess1 = mess1.createMessage()
inMess1.bodyText="""
<xsql:query xmlns:xsql="urn:oracle-xsql" connection="demomysql">
 SELECT * FROM tabla WHERE id = ${inMessage.properties.id}
</xsql:query>
"""
mess1.setMessage(inMess1,"in")
deliveryChannel.sendSync(mess1)
outMessage.bodyText = mess1.getMessage("out").bodyText

       ]]>
       </value>
     </property>
   </component>

   </components>
 </container>

 <!-- Transaction manager -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JotmFactoryBean"/>

 <!-- XSQL Datasource -->
 <bean id="mysql-prueba"
   class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
   <property name="user">
     <value>usuario</value>
   </property>
   <property name="password">
     <value></value>
   </property>
   <property name="serverName">
     <value>localhost</value>
   </property>
   <property name="databaseName">
     <value>prueba</value>
   </property>
 </bean>

 <!-- Echo -->
 <bean id="echo" class="Echo" singleton="true"/>

</beans>

Reply via email to