Interface MessageCollectionCallback<T>
- Type Parameters:
T- the expected item type.
- All Superinterfaces:
org.springframework.data.mongodb.core.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 org.springframework.data.mongodb.core.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
- See Also:
CollectionCallback
-
Method Summary
Modifier and Type Method Description default TdoInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection)TdoInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.springframework.messaging.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, org.springframework.messaging.Message<?> requestMessage) throws com.mongodb.MongoException, org.springframework.dao.DataAccessExceptionPerform 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 exceptionorg.springframework.dao.DataAccessException- the data access exception
-
doInCollection
default T doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection) throws com.mongodb.MongoException, org.springframework.dao.DataAccessException- Specified by:
doInCollectionin interfaceorg.springframework.data.mongodb.core.CollectionCallback<T>- Throws:
com.mongodb.MongoExceptionorg.springframework.dao.DataAccessException
-