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:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.integration.core.MessageSource<org.reactivestreams.Publisher<?>>, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationInboundManagement, org.springframework.integration.support.management.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
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.mongodb.inbound.AbstractMongoDbMessageSource

    queryExpression

    Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReactiveMongoDbMessageSource(org.springframework.data.mongodb.core.ReactiveMongoOperations reactiveMongoTemplate, org.springframework.expression.Expression queryExpression)
    Create an instance with the provided ReactiveMongoOperations and SpEL expression which should resolve to a Mongo 'query' string (see https://www.mongodb.org/display/DOCS/Querying).
    ReactiveMongoDbMessageSource(org.springframework.data.mongodb.ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory, org.springframework.expression.Expression queryExpression)
    Create an instance with the provided ReactiveMongoDatabaseFactory and SpEL expression which should resolve to a MongoDb 'query' string (see https://www.mongodb.org/display/DOCS/Querying).
  • Method Summary

    Modifier and Type
    Method
    Description
    Execute a Query returning its results as the Message payload.
     
    protected void
     

    Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource

    buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedType

    Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator

    afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService, setSimpleEvaluationContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs, isObserved, registerObservationRegistry

    Methods inherited from interface org.springframework.integration.core.MessageSource

    getIntegrationPatternType
  • Constructor Details

    • ReactiveMongoDbMessageSource

      public ReactiveMongoDbMessageSource(org.springframework.data.mongodb.ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory, org.springframework.expression.Expression queryExpression)
      Create an instance with the provided ReactiveMongoDatabaseFactory and 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 the AbstractMessageSource.receive() method.
      Parameters:
      reactiveMongoDatabaseFactory - The reactiveMongoDatabaseFactory factory.
      queryExpression - The query expression.
    • ReactiveMongoDbMessageSource

      public ReactiveMongoDbMessageSource(org.springframework.data.mongodb.core.ReactiveMongoOperations reactiveMongoTemplate, org.springframework.expression.Expression queryExpression)
      Create an instance with the provided ReactiveMongoOperations and SpEL expression which should resolve to a Mongo 'query' string (see https://www.mongodb.org/display/DOCS/Querying). It assumes that the ReactiveMongoOperations is fully initialized and ready to be used. The 'queryExpression' will be evaluated on every call to the AbstractMessageSource.receive() method.
      Parameters:
      reactiveMongoTemplate - The reactive Mongo template.
      queryExpression - The query expression.
  • Method Details