Class MongoDbOutboundGatewaySpec

All Implemented Interfaces:
DisposableBean, FactoryBean<MongoDbOutboundGateway>, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class MongoDbOutboundGatewaySpec extends MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
A MessageHandlerSpec extension for the MongoDb Outbound endpoint MongoDbOutboundGateway.
Since:
5.0
Author:
Xavier Padro, Artem Bilan
  • Constructor Details

  • 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<Message<P>,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<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