You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Daniel Langevin <da...@shq.gouv.qc.ca> on 2021/03/02 13:16:38 UTC

Rép. : Re: Can I call a PostgreSQL function from Camel-sql

Hi,


Here a sample using SqlStoredComponent with Postgresql, hope it's help


<blueprint .....

 <bean id="XXXdataSource" class="org.postgresql.ds.PGSimpleDataSource">
    <property name="ServerName" value="unit-XXX-YYY-central-1.rds.amazonaws.com"/>
    <property name="User" value="XXXXXXX" />
    <property name="Password" value="YYYYYYY" />
    <property name="PortNumber" value="5432"/>
    <property name="DatabaseName" value="XXXYYY/>
    <property name="Ssl" value="true"/>
    <property name="sslfactory" value="org.postgresql.ssl.NonValidatingFactory"/>
  </bean>

<bean id="XXXSqlStored" class="org.apache.camel.component.sql.stored.SqlStoredComponent">
      <property name="dataSource" ref="XXXdataSource" />
</bean>

<camelContext id="Contexte-XXX-YYY" xmlns="http://camel.apache.org/schema/blueprint" trace="false" >
...
...

<route id="rte.XXX.YYY">
  <from uri="direct:restSysTel" >
  <to uri="XXXSqlStored:xxx_prb_enreg_prise_appel(VARCHAR ${header.sysTelNoTelephone}, VARCHAR ${header.sysTelIdEmploye}, VARCHAR ${header.sysTelLangue}, VARCHAR ${header.sysTelIdFile}, VARCHAR ${header.sysTelSessionId} )"/>
...
...
...
</route>

...
..
</camelContext>
</blueprint>


Daniel Langevin


>>> 
De : 	Babak Vahdat <ba...@swissonline.ch>
À :	<us...@camel.apache.org>
Date : 	2021-03-02 05:12
Objet : 	Re: Can I call a PostgreSQL function from Camel-sql

Hi

There’s documentation about the IN, OUT and INOUT parameters for that:

https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters <https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters>

Babak

> On 1 Mar 2021, at 23:49, SRIKANT MVS <sr...@gmail.com> wrote:
> 
> Hi Team,
> I would like to call a DB function in PostgreSQL database using the
> camel-sql component. There are around 20-30 inParams that I would like to
> pass in a hashmap and get a single value in the outParams.
> 
> I am unable to find any examples for the same. Additionally, I have to make
> this call from a method, but not from a route. I couldn't find any
> references using ProducerTemplate.
> 
> Kindly share your valuable input on how I can achieve this in camel.
> 
> -Regards
> Srikant Mantha


Re: Rép. : Re: Can I call a PostgreSQL function from Camel-sql

Posted by SRIKANT MVS <sr...@gmail.com>.
Thanks for the information,
I will try this approach.

-Regards
Srikant Mantha

On Tue, 2 Mar, 2021, 14:16 Daniel Langevin, <da...@shq.gouv.qc.ca>
wrote:

> Hi,
>
>
> Here a sample using SqlStoredComponent with Postgresql, hope it's help
>
>
> <blueprint .....
>
>  <bean id="XXXdataSource" class="org.postgresql.ds.PGSimpleDataSource">
>     <property name="ServerName" value="
> unit-XXX-YYY-central-1.rds.amazonaws.com"/>
>     <property name="User" value="XXXXXXX" />
>     <property name="Password" value="YYYYYYY" />
>     <property name="PortNumber" value="5432"/>
>     <property name="DatabaseName" value="XXXYYY/>
>     <property name="Ssl" value="true"/>
>     <property name="sslfactory"
> value="org.postgresql.ssl.NonValidatingFactory"/>
>   </bean>
>
> <bean id="XXXSqlStored"
> class="org.apache.camel.component.sql.stored.SqlStoredComponent">
>       <property name="dataSource" ref="XXXdataSource" />
> </bean>
>
> <camelContext id="Contexte-XXX-YYY" xmlns="
> http://camel.apache.org/schema/blueprint" trace="false" >
> ...
> ...
>
> <route id="rte.XXX.YYY">
>   <from uri="direct:restSysTel" >
>   <to uri="XXXSqlStored:xxx_prb_enreg_prise_appel(VARCHAR
> ${header.sysTelNoTelephone}, VARCHAR ${header.sysTelIdEmploye}, VARCHAR
> ${header.sysTelLangue}, VARCHAR ${header.sysTelIdFile}, VARCHAR
> ${header.sysTelSessionId} )"/>
> ...
> ...
> ...
> </route>
>
> ...
> ..
> </camelContext>
> </blueprint>
>
>
> Daniel Langevin
>
>
> >>>
> De :    Babak Vahdat <ba...@swissonline.ch>
> À :     <us...@camel.apache.org>
> Date :  2021-03-02 05:12
> Objet :         Re: Can I call a PostgreSQL function from Camel-sql
>
> Hi
>
> There’s documentation about the IN, OUT and INOUT parameters for that:
>
>
> https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters
> <
> https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters
> >
>
> Babak
>
> > On 1 Mar 2021, at 23:49, SRIKANT MVS <sr...@gmail.com> wrote:
> >
> > Hi Team,
> > I would like to call a DB function in PostgreSQL database using the
> > camel-sql component. There are around 20-30 inParams that I would like to
> > pass in a hashmap and get a single value in the outParams.
> >
> > I am unable to find any examples for the same. Additionally, I have to
> make
> > this call from a method, but not from a route. I couldn't find any
> > references using ProducerTemplate.
> >
> > Kindly share your valuable input on how I can achieve this in camel.
> >
> > -Regards
> > Srikant Mantha
>
>