Results 1 to 10 of 10

Thread: jdbc:outbound-gateway query only

  1. #1
    Join Date
    Oct 2009
    Posts
    6

    Default jdbc:outbound-gateway query only

    trying to use jdbc:outbound-gateway to execute just a SQL query without an update, however schema requires an SQL update
    can i just execute a query and send the resultset to the reply-channel

    For example

    Code:
    <jdbc:outbound-gateway query="select * from foo" 
    	 request-channel="jdbcParametersChannel" reply-channel="resultSetChannel" 
            data-source="dataSource" />

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    So, I guess the use-case is that you want the query to be executed based on a trigger message? Otherwise, if you have a scheduled trigger, you could perform the query with a JDBC inbound adapter.

  3. #3
    Join Date
    Oct 2009
    Posts
    6

    Default

    my test case is using si:gateway to connect to jdbc:gateway. The resultset from jdbc:gateway is sent to reply channel of si:gateway.

    it is a client initiated request-reply pattern rather than a poller request

  4. #4

    Question

    Quote Originally Posted by Mark Fisher View Post
    So, I guess the use-case is that you want the query to be executed based on a trigger message? Otherwise, if you have a scheduled trigger, you could perform the query with a JDBC inbound adapter.
    if the use case is the former how do we go abt it ? i.e. execute a query based on a trigger message and use the resultset to trigger another service in a workflow ?

  5. #5
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Can you briefly describe the triggering situation for your particular app... ie. when the query should be executed?

  6. #6

    Question

    Quote Originally Posted by Mark Fisher View Post
    Can you briefly describe the triggering situation for your particular app... ie. when the query should be executed?
    Thanks for the quick reply.

    I am polling a file directory for files and based on the file name have to check whether these exist in a database based on which i have to continue further processing in the workflow.

    Code:
    <int-file:inbound-channel-adapter id="inputPublicationFiles"
        directory="someRemoteDirectory" auto-create-directory="false"
        filename-pattern="*.somepattern">
        <int:poller id="poller" fixed-rate="1000"></int:poller>
    
    <!-- just the filenames -->
     <int:transformer input-channel="inputPublicationFiles"
        expression="payload.name" output-channel="processPublicationFiles"></int:transformer>
    
      <int-jdbc:outbound-gateway request-channel="processPublicationFiles" query="select 'fileName' from someTable" reply-channel="processedPublicationFiles" data-source="dataSource"
      update="required ..?"></int-jdbc:outbound-gateway>

  7. #7

    Default

    will this be possible in the current spring architecture ?


    Quote Originally Posted by anshumania View Post
    Thanks for the quick reply.

    I am polling a file directory for files and based on the file name have to check whether these exist in a database based on which i have to continue further processing in the workflow.

    Code:
    <int-file:inbound-channel-adapter id="inputPublicationFiles"
        directory="someRemoteDirectory" auto-create-directory="false"
        filename-pattern="*.somepattern">
        <int:poller id="poller" fixed-rate="1000"></int:poller>
    
    <!-- just the filenames -->
     <int:transformer input-channel="inputPublicationFiles"
        expression="payload.name" output-channel="processPublicationFiles"></int:transformer>
    
      <int-jdbc:outbound-gateway request-channel="processPublicationFiles" query="select 'fileName' from someTable" reply-channel="processedPublicationFiles" data-source="dataSource"
      update="required ..?"></int-jdbc:outbound-gateway>

  8. #8

    Question using jdbc template instead but ..

    For now am using a serviceActivator to invoke a JDBC template to do the same.
    However i was still wondering if this gateway would be able to support the above scenario or why not ? Invoking a jdbc request to select a few items from a db based on an event and send them to another channel seems to be part of the event driven architecture scenario or not ?

  9. #9
    Join Date
    Aug 2011
    Posts
    1

    Default

    Any resolution on this? I am new to Spring Integration and likewise it seems to me that the outbound gateway should support select only. Thanks!

  10. #10
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Please raise a new JIRA issue requesting that the UPDATE be optional for a JDBC outbound-gateway.

    However, for a case like this where the inbound Message would be nothing more than a trigger (it contains no information needed for the action to be taken), it might be worth considering a more general new feature (one that has been discussed before but not implemented). We could have any inbound-channel-adapter with a trigger-channel as an alternative to the poller... or perhaps the <poller> itself would have a trigger channel rather than a fixed-rate/fixed-delay/cron or Trigger reference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •