Class StoredProcOutboundGateway

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHandler
An AbstractReplyProducingMessageHandler implementation for performing RDBMS stored procedures which return results.
Gunnar Hillert, Artem Bilan
  • Constructor Details

    • StoredProcOutboundGateway

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

    • setRequiresReply

      public void setRequiresReply(boolean requiresReply)
      Description copied from class: AbstractReplyProducingMessageHandler
      Flag whether a reply is required. If true an incoming message MUST result in a reply message being sent. If false an incoming message MAY result in a reply message being sent. Default is false.
      setRequiresReply in class AbstractReplyProducingMessageHandler
      requiresReply - true if a reply is required.
    • 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 == 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.

      When set to true, a setRequiresReply(boolean) is called with true as well, indicating that exactly single result is expected and null isn't appropriate value. A ReplyRequiredException is thrown in case of null result.

      expectSingleResult - true if a single result is expected.
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      getComponentType in class MessageHandlerSupport
    • doInit

      protected void doInit()
      doInit in class AbstractReplyProducingMessageHandler
    • handleRequestMessage

      protected Object handleRequestMessage(Message<?> requestMessage)
      Description copied from class: AbstractReplyProducingMessageHandler
      Subclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.
      Specified by:
      handleRequestMessage in class AbstractReplyProducingMessageHandler
      requestMessage - The request message.
      The result of handling the message, or null.