0

iam developing reactive kafka in our play scala project, in the project we created 5 topic which are subscribed by consumer group and working good, now the problem is i created a new topic, how can i add this topic to the existing consumer group ( is it possible) my code is :

val consumerSettings = ConsumerSettings(system, new ByteArrayDeserializer, new StringDeserializer)
      .withBootstrapServers(bootStrapServer)
      .withGroupId(groupId).withPollInterval(100 millis)

   Consumer.committableSource(consumerSettings, Subscriptions.topics(topicList))
            .groupedWithin(10, 15 seconds)
            .map({
              group =>
                var offSetBatch = CommittableOffsetBatch.empty
                val sessionList = group.toList.map { eachItem =>
                  offSetBatch = offSetBatch.updated(eachItem.committableOffset)
                  Json.parse(eachItem.record.value()).as[cityModel]
                }
                processRecords(cityList)
                offSetBatch
            }).mapAsync(1)(_.commitScaladsl())
            .toMat(Sink.ignore)(Keep.both)
            .run()

is there any way that i can add topic to consumer

Kiran Sunkari
  • 301
  • 1
  • 3
  • 15

1 Answers1

0

While creating a consumer, we can give topic a pattern as

Subscriptions.topicPattern("*.in") this should will solve problem

Yasasvee
  • 196
  • 1
  • 11
Kiran Sunkari
  • 301
  • 1
  • 3
  • 15