Class ReactiveMongoDbMessageSource
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<T>
org.springframework.integration.mongodb.inbound.AbstractMongoDbMessageSource<org.reactivestreams.Publisher<?>>
org.springframework.integration.mongodb.inbound.ReactiveMongoDbMessageSource
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- MessageSource<org.reactivestreams.Publisher<?>>,- IntegrationPattern,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement
public class ReactiveMongoDbMessageSource
extends AbstractMongoDbMessageSource<org.reactivestreams.Publisher<?>>
An instance of 
MessageSource which returns
 a Message with a payload which is the result of
 execution of a Query. When expectSingleResult is false (default), the MongoDb
 Query is executed using ReactiveMongoOperations.find(Query, Class) method which
 returns a Flux.
 The returned Flux will be used as the payload of the
 Message returned by the AbstractMessageSource.receive()
 method.
 
 When expectSingleResult is true, the ReactiveMongoOperations.findOne(Query, Class) is
 used instead, and the message payload will be a Mono
 for the single object returned from the query.
- Since:
- 5.3
- Author:
- David Turanski, Artem Bilan
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.mongodb.inbound.AbstractMongoDbMessageSourcequeryExpressionFields inherited from class org.springframework.integration.util.AbstractExpressionEvaluatorEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
- 
Constructor SummaryConstructorsConstructorDescriptionReactiveMongoDbMessageSource(ReactiveMongoOperations reactiveMongoTemplate, Expression queryExpression) Create an instance with the providedReactiveMongoOperationsand SpEL expression which should resolve to a Mongo 'query' string (see https://www.mongodb.org/display/DOCS/Querying).ReactiveMongoDbMessageSource(ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory, Expression queryExpression) Create an instance with the providedReactiveMongoDatabaseFactoryand SpEL expression which should resolve to a MongoDb 'query' string (see https://www.mongodb.org/display/DOCS/Querying).
- 
Method SummaryMethods inherited from class org.springframework.integration.mongodb.inbound.AbstractMongoDbMessageSourceevaluateCollectionNameExpression, evaluateQueryExpression, evaluateUpdateExpression, getApplicationContext, getByIdInQuery, getCollectionNameExpression, getEntityClass, getMongoConverter, getUpdateExpression, idForEntity, isExpectSingleResult, isInitialized, setApplicationContext, setCollectionNameExpression, setEntityClass, setExpectSingleResult, setInitialized, setMongoConverter, setUpdateExpressionMethods inherited from class org.springframework.integration.endpoint.AbstractMessageSourcebuildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from class org.springframework.integration.util.AbstractExpressionEvaluatorafterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionServiceMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAs, isObserved, registerObservationRegistryMethods inherited from interface org.springframework.integration.core.MessageSourcegetIntegrationPatternType
- 
Constructor Details- 
ReactiveMongoDbMessageSourcepublic ReactiveMongoDbMessageSource(ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory, Expression queryExpression) Create an instance with the providedReactiveMongoDatabaseFactoryand SpEL expression which should resolve to a MongoDb 'query' string (see https://www.mongodb.org/display/DOCS/Querying). The 'queryExpression' will be evaluated on every call to theAbstractMessageSource.receive()method.- Parameters:
- reactiveMongoDatabaseFactory- The reactiveMongoDatabaseFactory factory.
- queryExpression- The query expression.
 
- 
ReactiveMongoDbMessageSourcepublic ReactiveMongoDbMessageSource(ReactiveMongoOperations reactiveMongoTemplate, Expression queryExpression) Create an instance with the providedReactiveMongoOperationsand SpEL expression which should resolve to a Mongo 'query' string (see https://www.mongodb.org/display/DOCS/Querying). It assumes that theReactiveMongoOperationsis fully initialized and ready to be used. The 'queryExpression' will be evaluated on every call to theAbstractMessageSource.receive()method.- Parameters:
- reactiveMongoTemplate- The reactive Mongo template.
- queryExpression- The query expression.
 
 
- 
- 
Method Details- 
getComponentType
- 
onInitprotected void onInit()- Overrides:
- onInitin class- AbstractMongoDbMessageSource<org.reactivestreams.Publisher<?>>
 
- 
doReceiveExecute aQueryreturning its results as the Message payload. The payload can be eitherFluxorMonoof objects of type identified byAbstractMongoDbMessageSource.getEntityClass(), or a single element of type identified byAbstractMongoDbMessageSource.getEntityClass()based on the value ofAbstractMongoDbMessageSource.isExpectSingleResult()attribute which defaults to 'false' resultingMessagewith payload of typeFlux. The collection name used in the query will be provided in theMongoHeaders.COLLECTION_NAMEheader.- Specified by:
- doReceivein class- AbstractMessageSource<org.reactivestreams.Publisher<?>>
- Returns:
- The value returned.
 
 
-