A consumer that allows you to insert records into MongoDB.
The MongoDbConsumerConfiguration
auto-configuration provides the following beans:
Function<Message<?>, Mono<Void>> mongodbConsumerFunction
- Allows you to subscribe.
Consumer<Message<?>> mongodbConsumer
- Wraps the function as a Consumer with no-op subscriber.
You can use mongodbConsumer
or mongodbConsumerFunction
as a qualifier when injecting.
The return value from the function can be ignored as this is used as a consumer to send records to MongoDB.
All configuration properties are prefixed with mongodb.consumer
.
For more information on the various options available, please see MongoDBConsumerProperties.
A ComponentCustomizer<ReactiveMongoDbStoringMessageHandler>
bean can be added in the target project to provide any custom options for the ReactiveMongoDbStoringMessageHandler
configuration used by the mongodbConsumer
.
See this test suite for the various ways, this consumer is used.
See this README where this consumer is used to create a Spring Cloud Stream application where it makes a MongoDB sink.