Class R2dbcMessageSource

java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<org.reactivestreams.Publisher<?>>
org.springframework.integration.r2dbc.inbound.R2dbcMessageSource
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, MessageSource<org.reactivestreams.Publisher<?>>, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement

public class R2dbcMessageSource
extends AbstractMessageSource<org.reactivestreams.Publisher<?>>
An instance of MessageSource which returns a Message with a payload which is the result of execution of query. When expectSingleResult is false (default), the R2DBC query is executed returning 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 query is executed returning a Mono for the single object returned from the query.

Since:
5.4
Author:
Rohan Mukesh, Artem Bilan
  • Constructor Details

    • R2dbcMessageSource

      public R2dbcMessageSource​(org.springframework.data.r2dbc.core.R2dbcEntityOperations r2dbcEntityOperations, String query)
      Create an instance with the provided R2dbcEntityOperations and SpEL expression which should resolve to a Relational 'query' string. It assumes that the R2dbcEntityOperations is fully initialized and ready to be used. The 'query' will be evaluated on every call to the AbstractMessageSource.receive() method.
      Parameters:
      r2dbcEntityOperations - The reactive database client for performing database calls.
      query - The query String.
    • R2dbcMessageSource

      public R2dbcMessageSource​(org.springframework.data.r2dbc.core.R2dbcEntityOperations r2dbcEntityOperations, Expression queryExpression)
      Create an instance with the provided R2dbcEntityOperations and SpEL expression which should resolve to a query string or StatementMapper.SelectSpec instance. It assumes that the R2dbcEntityOperations is fully initialized and ready to be used. The 'queryExpression' will be evaluated on every call to the AbstractMessageSource.receive() method.
      Parameters:
      r2dbcEntityOperations - The reactive for performing database calls.
      queryExpression - The query expression. The root object for evaluation context is a R2dbcMessageSource.SelectCreator for delegation int the StatementMapper.createSelect(java.lang.String) fluent API.
  • Method Details