Announcement Announcement Module
Collapse
No announcement yet.
jdbc:outbound-gateway query only Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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

      Comment


      • #4
        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 ?

        Comment


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

          Comment


          • #6
            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>

            Comment


            • #7
              will this be possible in the current spring architecture ?


              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>

              Comment


              • #8
                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 ?

                Comment


                • #9
                  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!

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X