Class StoredProcOutboundGateway
- All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.core.Ordered,org.springframework.integration.context.ExpressionCapable,org.springframework.integration.context.Orderable,org.springframework.integration.core.MessageProducer,org.springframework.integration.handler.HeaderPropagationAware,org.springframework.integration.IntegrationPattern,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement,org.springframework.integration.support.management.TrackableComponent,org.springframework.messaging.MessageHandler,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class StoredProcOutboundGateway
extends org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler implementation for performing
RDBMS stored procedures which return results.- Since:
- 2.1
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description StoredProcOutboundGateway(StoredProcExecutor storedProcExecutor)Constructor takingStoredProcExecutor. -
Method Summary
Modifier and Type Method Description protected voiddoInit()java.lang.StringgetComponentType()protected java.lang.ObjecthandleRequestMessage(org.springframework.messaging.Message<?> requestMessage)voidsetExpectSingleResult(boolean expectSingleResult)This parameter indicates that only one result object shall be returned from the Stored Procedure/Function Call.voidsetRequiresReply(boolean requiresReply)Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoaderMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribeMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
StoredProcOutboundGateway
Constructor takingStoredProcExecutor.- Parameters:
storedProcExecutor- Must not be null.
-
-
Method Details
-
setRequiresReply
public void setRequiresReply(boolean requiresReply)- Overrides:
setRequiresReplyin classorg.springframework.integration.handler.AbstractReplyProducingMessageHandler
-
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 totrue, aresultMapthat contains only 1 element, will have that 1 element extracted and returned as payload.If the
resultMapcontains more than 1 element andexpectSingleResult == true, then aMessagingExceptionis thrown.Otherwise the complete
resultMapis returned as theMessagepayload.Important Note: Several databases such as H2 are not fully supported. The H2 database, for example, does not fully support the
CallableStatementsemantics 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.When set to
true, asetRequiresReply(boolean)is called withtrueas well, indicating that exactly single result is expected andnullisn't appropriate value. AReplyRequiredExceptionis thrown in case ofnullresult.- Parameters:
expectSingleResult- true if a single result is expected.
-
getComponentType
public java.lang.String getComponentType()- Specified by:
getComponentTypein interfaceorg.springframework.integration.support.context.NamedComponent- Overrides:
getComponentTypein classorg.springframework.integration.handler.MessageHandlerSupport
-
doInit
protected void doInit()- Overrides:
doInitin classorg.springframework.integration.handler.AbstractReplyProducingMessageHandler
-
handleRequestMessage
protected java.lang.Object handleRequestMessage(org.springframework.messaging.Message<?> requestMessage)- Specified by:
handleRequestMessagein classorg.springframework.integration.handler.AbstractReplyProducingMessageHandler
-