Announcement Announcement Module
Collapse
No announcement yet.
Multiple Datasources to be connected to a Single JDBC Inbound Channel Adapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Datasources to be connected to a Single JDBC Inbound Channel Adapter

    Hi,

    I have a query regarding a use-case where I have 3 separate Data Sources. I have searched on the forum already and havent found a use-case such as this.

    I am firing the same query in all 3 of them once a day (everyday). Each query fired generates a single String message.

    Presently I am implementing like this:-

    DataSource1 ->JDBC Inbound Channel Adapter 1 \

    DataSource2 ->JDBC Inbound Channel Adapter 2 ---> Service Activator

    DataSource3 ->JDBC Inbound Channel Adapter 3 /

    Now, These 3 channel adapters seem to be an unnecessary overhead on the lines of code.
    Is it possible for me to use only ONE channel adapter and read the databases in a one-by-one fashion?

    Thanks in Advance.

  • #2
    The purpose of any adapter is to be some type of a protocol specific gateway to a particular remote address. The last two words are important since you can always pin an adapter to a specific remotely addressable location.
    Look at it this way:
    When you receive an email you know where it came from and who its going too. You can also aggregate several emails coming from different adresses into some type of a single aggregate. However you would NOT expect any email server to be responsible for such aggregation. At best you may want to find an email client where you can set up a rule where you would define how such aggregation would happen or you'd do it yourself manually. And that is exactly what you are doing with SI. You are setting up a rule to receive data from 3 different remote addresses and send them to a single processor. I don't think its an overhead, but rather a good, flexible and extensible design on your end.
    Hope that helps

    Comment


    • #3
      Thanks for the early reply.

      One thing more I want to know. Can you please suggest me the proper architecture for my requirement? My requirement is as follows:

      -->I need to execute same query on 3 data sources, fetch data(some what 3000-5000 rows from each data source) and then right it in a single file.
      -->This process of execution of query and writing into a file need to be done only once a day.

      Currently I am following the attached architecture Attachment .

      When I was trying to write the msgs(3 msgs) directly without using aggregator, then it was generating separate files. One with the correct name (i.e. 20120227.csv) but second file was generated with extension .csvnull (i.e. 20120227.csvnull), it was neither over writing that nor appending. I want to generate only one file.

      This was achieved by using aggregator, using this I set the releaseStrategy property and waited till I receive 3 msgs and after that it generated a single msg, which can be written as file.

      So, my questions are:
      -->Is there any simple architecture which I can follow to implement my requirement?
      -->Is it possible to append the existing file using Spring Integration?
      -->How can I write multiple msgs to a single file?(without using aggregator, by this I mean not just creating a single msg and then writing it into a file)?
      -->How to over write an existing file using Spring Integration? Why is it generating the file with the extension .csvnull

      Thanks,
      DevSpring
      Attached Files

      Comment


      • #4
        Hello

        I think you need to follow with Spring Batch

        Good luck,
        Artem Bilan

        Comment

        Working...
        X