Class StoredProcPollingChannelAdapter

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, MessageSource<Object>, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement

public class StoredProcPollingChannelAdapter extends AbstractMessageSource<Object>
A polling channel adapter that creates messages from the payload returned by executing a stored procedure or Sql function. Optionally an update can be executed after the execution of the Stored Procedure or Function in order to update processed rows.
Since:
2.1
Author:
Gunnar Hillert, Artem Bilan, Gary Russell
  • Constructor Details

    • StoredProcPollingChannelAdapter

      public StoredProcPollingChannelAdapter(StoredProcExecutor storedProcExecutor)
      Constructor taking StoredProcExecutor.
      Parameters:
      storedProcExecutor - Must not be null.
  • Method Details

    • setExpectSingleResult

      public void setExpectSingleResult(boolean expectSingleResult)
      This parameter indicates that only one result object shall be returned from the Stored Procedure/Function Call. If set to true, a resultMap that contains only 1 element, will have that 1 element extracted and returned as payload. If the resultMap contains more than 1 element and expectSingleResult is true, then a MessagingException is thrown. Otherwise the complete resultMap is returned as the Message payload. Important Note: Several databases such as H2 are not fully supported. The H2 database, for example, does not fully support the CallableStatement semantics and when executing function calls against H2, a result list is returned rather than a single value. Therefore, even if you set expectSingleResult = true, you may end up with a collection being returned.
      Parameters:
      expectSingleResult - true if a single result is expected.
    • doReceive

      protected Object doReceive()
      Execute the select query and the update query if provided. Returns the rows returned by the select query. If a RowMapper has been provided, the mapped results are returned.
      Specified by:
      doReceive in class AbstractMessageSource<Object>
      Returns:
      The value returned.
    • getComponentType

      public String getComponentType()