Class MongoDbOutboundGatewaySpec

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,H>
org.springframework.integration.dsl.MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
org.springframework.integration.mongodb.dsl.MongoDbOutboundGatewaySpec
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<MongoDbOutboundGateway>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class MongoDbOutboundGatewaySpec extends org.springframework.integration.dsl.MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
A MessageHandlerSpec extension for the MongoDb Outbound endpoint MongoDbOutboundGateway.
Since:
5.0
  • Field Summary

    Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    PARSER, target

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.core.MongoOperations mongoTemplate)
     
    protected
    MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter mongoConverter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Reference to an instance of MessageCollectionCallback which specifies the database operation to execute in the request message context.
    collectionName(String collectionName)
    Identify the name of the MongoDb collection to use.
    collectionNameExpression(String collectionNameExpression)
    A SpEL expression which should resolve to a String value identifying the name of the MongoDb collection to use.
    collectionNameFunction(Function<org.springframework.messaging.Message<P>,String> collectionNameFunction)
    A Function which should resolve to a String (e.q., collectionNameFunction(Message::getPayload)).
    entityClass(Class<?> entityClass)
    The fully qualified name of the entity class to be passed to find(..) or findOne(..) method in MongoOperations.
    expectSingleResult(boolean expectSingleResult)
    This parameter indicates that only one result object will be returned from the database by using a findOne query.
    query(String query)
    A String representation of a MongoDb Query (e.g., query("{'name' : 'Bob'}")).
    queryExpression(String queryExpression)
    A SpEL expression which should resolve to a String query (please refer to the 'query' property), or to an instance of MongoDb Query (e.q., queryExpression("new BasicQuery('{''address.state'' : ''PA''}')")).
    queryFunction(Function<org.springframework.messaging.Message<P>,org.springframework.data.mongodb.core.query.Query> queryFunction)
    A Function which should resolve to a Query instance.

    Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    _this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MongoDbOutboundGatewaySpec

      protected MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter mongoConverter)
    • MongoDbOutboundGatewaySpec

      protected MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.core.MongoOperations mongoTemplate)
  • Method Details

    • expectSingleResult

      public MongoDbOutboundGatewaySpec expectSingleResult(boolean expectSingleResult)
      This parameter indicates that only one result object will be returned from the database by using a findOne query. If set to false (default), the complete result list is returned as the payload.
      Parameters:
      expectSingleResult - the boolean flag to indicate if a single result is returned or not.
      Returns:
      the spec
    • query

      public MongoDbOutboundGatewaySpec query(String query)
      A String representation of a MongoDb Query (e.g., query("{'name' : 'Bob'}")). Please refer to MongoDb documentation for more query samples see MongoDB Docs This property is mutually exclusive with 'queryExpression' property.
      Parameters:
      query - the MongoDb Query string representation to use.
      Returns:
      the spec
    • queryExpression

      public MongoDbOutboundGatewaySpec queryExpression(String queryExpression)
      A SpEL expression which should resolve to a String query (please refer to the 'query' property), or to an instance of MongoDb Query (e.q., queryExpression("new BasicQuery('{''address.state'' : ''PA''}')")).
      Parameters:
      queryExpression - the SpEL expression query to use.
      Returns:
      the spec
    • queryFunction

      public <P> MongoDbOutboundGatewaySpec queryFunction(Function<org.springframework.messaging.Message<P>,org.springframework.data.mongodb.core.query.Query> queryFunction)
      A Function which should resolve to a Query instance.
      Type Parameters:
      P - the type of the message payload.
      Parameters:
      queryFunction - the Function to use.
      Returns:
      the spec
    • entityClass

      public MongoDbOutboundGatewaySpec entityClass(Class<?> entityClass)
      The fully qualified name of the entity class to be passed to find(..) or findOne(..) method in MongoOperations. If this attribute is not provided the default value is Document.
      Parameters:
      entityClass - the Class to use.
      Returns:
      the spec
    • collectionName

      public MongoDbOutboundGatewaySpec collectionName(String collectionName)
      Identify the name of the MongoDb collection to use. This attribute is mutually exclusive with collectionNameExpression(java.lang.String) property.
      Parameters:
      collectionName - the String specifying the MongoDb collection.
      Returns:
      the spec
    • collectionNameExpression

      public MongoDbOutboundGatewaySpec collectionNameExpression(String collectionNameExpression)
      A SpEL expression which should resolve to a String value identifying the name of the MongoDb collection to use. This property is mutually exclusive with collectionName(java.lang.String) property.
      Parameters:
      collectionNameExpression - the String expression to use.
      Returns:
      the spec
    • collectionNameFunction

      public <P> MongoDbOutboundGatewaySpec collectionNameFunction(Function<org.springframework.messaging.Message<P>,String> collectionNameFunction)
      A Function which should resolve to a String (e.q., collectionNameFunction(Message::getPayload)).
      Type Parameters:
      P - the type of the message payload.
      Parameters:
      collectionNameFunction - the Function to use.
      Returns:
      the spec
    • collectionCallback

      public <P> MongoDbOutboundGatewaySpec collectionCallback(MessageCollectionCallback<P> collectionCallback)
      Reference to an instance of MessageCollectionCallback which specifies the database operation to execute in the request message context. This property is mutually exclusive with query(java.lang.String) and queryExpression(java.lang.String) properties.
      Type Parameters:
      P - the type of the message payload.
      Parameters:
      collectionCallback - the MessageCollectionCallback instance
      Returns:
      the spec
      Since:
      5.0.11