Announcement Announcement Module
No announcement yet.
What data type does the channel send to a transformer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • What data type does the channel send to a transformer

    What data-type does the channel send to a transformer?
    eg. if i am using this configuration

    data-source="datasource1" query="select * from course2" channel="input">
    <intoller fixed-rate="10" >

    so what does it send to the transformer?

    <bean id="courseTrasformer" class="org.mkcl.integration.service.CourseTrasform er"></bean>
    <int:transformer input-channel="input" output-channel="output"
    ref="courseTrasformer" method="transform" id="coursetransformer">

    so what shud be the Datatype of the parameters in the method transform?
    Is it specific to the adapter we are using?

    Please help.

  • #2

    Is it specific to the adapter we are using?
    Of course it can be but isn't obligatorily: just to make the parameter as Object payload and take a look in the debug what you receive after JDBC-adapter.
    But it more simple: JDBC-adapters use on the background Spring JDBC, so in most cases it is JdbcTemplate which requires some implementation of RowMapper for queries.
    <jdbc:inbound-channel-adapter> are using ColumnMapRowMapper by default. In this case your result will be a List with Map elements, where each Map is a column/value presentation for your SELECT.

    Is it clear?

    Take care,


    • #3
      Thanks @Cleric

      One more query...
      I have to simply copy data from one schema to another
      the tables and schema are all ready..

      i m using the following code..
      <bean id="datasource2"

      <bean id="datasource1"

      <int:channel id="jdbcoutput">
      <int:queue capacity="100"/>

      <int-jdbc:inbound-channel-adapter data-source="datasource1" query="select * from course1" channel="jdbcoutput" >
      <intoller fixed-rate="1000"></intoller>

      <int:service-activator ref="serviceactivator" input-channel="jdbcoutput">

      <int-jdbc:outbound-channel-adapter channel="jdbcoutput" query="WHAT SHUD I WRITE HERE?">

      <bean id="serviceactivator" class="dmd.ddd.ddd.service.TempServiceActivator"></bean>

      public List<course> getdata(List<Course> list){

      return list;

      Since return type is a list..what shud i write in the jdbc:outbound-channel-adapter to write the database
      Is there no other option than writing the insert query?

      What is the best way to do this other than this noobe method.


      • #4

        I'm not sure what fo you mean since your config looks wrong. But regarding <jdbc:outbound-channel-adapter> and your List.
        There is some trick: place before <jdbc:outbound-channel-adapter> <splitter>. So, it will look like this:
        HTML Code:
        <int:service-activator ref="serviceactivator" input-channel="serviceInput" output-channel="jdbcoutput"/>
        <chain input-channel="jdbcoutput">
          <int-jdbc:outbound-channel-adapter query="insert into ..."/>
        Is it appropriate?


        • #5
          Thank you again.
          I am learning by doing.. so i m making so many mistakes.
          ok. we are inserting the data by using chain... i didn't think of it.. thanks
          but splitter...that i couldn't understand. please can u elaborate more... because splitter is used to split one complete message into different will the query take these separate methods to insert?

          And one more problem...
          since i m copying the data, the table will have primary keys.. so after inserting the data once, won't i get duplicate entry error because it will again try to insert them.
          and what if i have to update at some places and insert at some places?

          I am really learning a lot from u. So please help. Thanks a lot.


          • #6
            will have primary keys
            It's up to you. You should understand what is the primary key in your case
            have to update at some places and insert at some places?
            You can achieve via JPA EntityManager.merge or via Stored Procedure: