@FunctionalInterface public interface MessageCollectionCallback<T> extends CollectionCallback<T>
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
.
CollectionCallback
Modifier and Type | Method and Description |
---|---|
default T |
doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection) |
T |
doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection,
Message<?> requestMessage)
Perform a Mongo operation in the collection using request message as a context.
|
@Nullable T doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection, Message<?> requestMessage) throws com.mongodb.MongoException, DataAccessException
collection
- never null.requestMessage
- the request message ot use for operationscom.mongodb.MongoException
- the MongoDB-specific exceptionDataAccessException
- the data access exceptiondefault T doInCollection(com.mongodb.client.MongoCollection<org.bson.Document> collection) throws com.mongodb.MongoException, DataAccessException
doInCollection
in interface CollectionCallback<T>
com.mongodb.MongoException
DataAccessException