0

I am using spring data r2dbc in my new project and need to connect multiple data sources like A data source and B data source. Is there a way to connect multiple data sources using r2dbc? Could I get an example or a document if there is a way?

My stacks are below:

  • Spring Boot 2.3.0.M4
  • Spring WebFlux
  • Spring Data R2DBC
devsh
  • 331
  • 1
  • 4
  • 10

2 Answers2

6

If you want to use multiple datasources in a single application, check my multi r2dbc connection factories example.

If you need a multi-tenant like feature check this multi-tenancy-r2dbc example.

Hantsy
  • 8,006
  • 7
  • 64
  • 109
1

I solved this issue using AbstractRoutingConnectionFactory you can check Add support for AbstractRoutingConnectionFactory

devsh
  • 331
  • 1
  • 4
  • 10