2

I have a consumer and want to subscribe to two different topics with different schema. One of this topic I need to configure like below:

var schemaRegistry = new CachedSchemaRegistryClient(new SchemaRegistryConfig
            {
                Url = ConsumerConfig.SchemaRegistryUrl,
                BasicAuthUserInfo = ConsumerConfig.SchemaRegistryBasicAuthCredentials,
            });

But another Topic I have doesn't need any SchemaRegistryBasicAuthCredentials.(Then I think it will be two different consumer Builder). Is it possible to subscribe to two different topics like this with one consumer?

  • I would say no. Even you find a work-around for that, its a really bad smell on your code. Keep things separately, you have all those differences on the Consumer side now, it would change for more complex stuff and you will have to do a lot of work lately. You can create 2 consumers, for 2 different topics that have 2 different configuration. And, if you have same behavior, you can join they both in a single middleware... (even I think its not a good approach) – Gabriel Scavassa Dec 01 '21 at 14:38
  • 1
    Thanks. I think its best to create another project for my second consumer than. :) – Parham Gitijah Dec 09 '21 at 13:52

0 Answers0