Class StoredProcPollingChannelAdapter
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<Object>
org.springframework.integration.jdbc.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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
Constructor Summary
Constructors Constructor Description StoredProcPollingChannelAdapter(StoredProcExecutor storedProcExecutor)Constructor takingStoredProcExecutor. -
Method Summary
Modifier and Type Method Description protected ObjectdoReceive()Execute the select query and the update query if provided.StringgetComponentType()voidsetExpectSingleResult(boolean expectSingleResult)This parameter indicates that only one result object shall be returned from the Stored Procedure/Function Call.Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource
buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setBeanFactory, setConversionServiceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.core.MessageSource
getIntegrationPatternType
-
Constructor Details
-
StoredProcPollingChannelAdapter
Constructor takingStoredProcExecutor.- 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 aMessagingExceptionis thrown. Otherwise the complete resultMap is returned as theMessagepayload. Important Note: Several databases such as H2 are not fully supported. The H2 database, for example, does not fully support theCallableStatementsemantics 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
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:
doReceivein classAbstractMessageSource<Object>- Returns:
- The value returned.
-
getComponentType
-