Interface MessageCollectionCallback<T>

Type Parameters:
T - the expected item type.
All Superinterfaces:
CollectionCallback<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MessageCollectionCallback<T> extends CollectionCallback<T>
The callback to be used with the MongoDbOutboundGateway as an alternative to other query options on the gateway.

Plays the same role as standard CollectionCallback, but with Message<?> requestMessage context during handleMessage() process in the MongoDbOutboundGateway.

Since:
5.0.11
Author:
Artem Bilan
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection)
     
    doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection, Message<?> requestMessage)
    Perform a Mongo operation in the collection using request message as a context.
  • Method Details

    • doInCollection

      @Nullable T doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection, Message<?> requestMessage) throws com.mongodb.MongoException, DataAccessException
      Perform a Mongo operation in the collection using request message as a context.
      Parameters:
      collection - never null.
      requestMessage - the request message ot use for operations
      Returns:
      can be null.
      Throws:
      com.mongodb.MongoException - the MongoDB-specific exception
      DataAccessException - the data access exception
    • doInCollection

      default T doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection) throws com.mongodb.MongoException, DataAccessException
      Specified by:
      doInCollection in interface CollectionCallback<T>
      Throws:
      com.mongodb.MongoException
      DataAccessException