Skip to content

Multi tenant setup support - Supporting connecting to multiple Pulsar instances #1359

@nandorholozsnyak

Description

@nandorholozsnyak

Hello there,
I'm working on a project where I want to connect to multiple Pulsar instances and based on what I have found Spring Pulsar "strictly" supports connecting to one Pulsar instance at a time.

I've managed to overwrite the PulsarAutoConfiguration class related beans, but it is a pain to handle them properly, as there are a few inconviniences during the setup like using @Primary and @Fallback beans in case of integration tests.

My "dream" setup would be the following:

spring:
  pulsar:
    tenant-a:
      service-url: pulsar://localhost:6650
    tenant-b:
      service-url: pulsar://localhost:6651
    tenant-c:
      service-url: pulsar://localhost:6652

Right now I create 3 new configuration properties which will create 3 PulsarClient instances, and all the needed dependencies like the:

  • DefaultPulsarConsumerFactory
  • DefaultPulsarProducerFactory
  • ConcurrentPulsarListenerContainerFactory
  • PulsarTemplate
    Where the PulsarClients are using the newly created one with the right service Url and authentication if needed.

Is there any better/already provided solution to my problem that would be cool.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions