dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

Dapr pubsub tried to use a consumer group that was closed

Open ibrahimsen opened this issue 1 year ago • 5 comments

Ask your question here

Hello,

I'm using Dapr for sending and receiving messages from kafka with .net. I have an multiple controller for multiple topics. When starting application in kubernates then it has bellow error. If dapr subscribe single topic, then everything is ok but multiple topic subscriptions has an exception has occured. How can I solve this issue? Any suggestion for this?

level=info msg="app is subscribed to the following topics: [Topic1 Topic 2] through pubsub=........."

level=error msg="Error consuming [Topic1]. Retrying...: kafka: tried to use a consumer group that was closed" 

Contoller 1:

public class Topic1Controller : ControllerBase
{

   [Topic("pubsub-name", "Topic1")]
   public Task HandleAsync(Topic1Event @event)
    {
        return Task.CompletedTask;
    }
 }

Controller 2:

public class Topic2Controller : ControllerBase
{
  [Topic("pubsub-name", "Topic2")]
  public Task HandleAsync(Topic2Event @event)
    {
        return Task.CompletedTask;
    }
 }

ibrahimsen avatar Sep 30 '23 19:09 ibrahimsen

@ibrahimsen - This behavior is defined by the actual component, not the .NET SDK. I would ask about it in the components-contrib repo or the components-contrib discord.

It could still technically be a .NET issue, but we have example apps that use multiple topics on the same component, so I think we should investigate with the kafka component first.

halspang avatar Oct 02 '23 17:10 halspang

I tried with Subscription.yaml as below but there is same behaviour. It's not about a donet-sdk as you said. It can be about a pubsub component.

subscription.yaml

apiVersion: [dapr.io/v1alpha1](http://dapr.io/v1alpha1)
kind: Subscription
metadata:
  name: topic1-subscription
spec:
  topic: Topic1
  route: /api/test/topic1
  pubsubname: app-pubsub
scopes:
- notification
 
---
 
apiVersion: [dapr.io/v1alpha1](http://dapr.io/v1alpha1)
kind: Subscription
metadata:
  name: topic2-subscription
spec:
  topic: Topic2
  route: /api/test/topic2
  pubsubname: app-pubsub
scopes:
- notification

pubsub.yaml

apiVersion: [dapr.io/v1alpha1](http://dapr.io/v1alpha1)
kind: Component
metadata:
  name: app-pubsub
  namespace: test-app
spec:
  type: pubsub.kafka
  version: v1
  metadata:
  - name: brokers
    value: "kafka-host"
  - name: consumerGroup
    value: "test-app"
  - name: consumerID
    value: "test-app"
  - name: clientID
    value: "test-app"
  - name: authType
    value: "certificate"
  - name: consumeRetryInterval 
    value: 200ms
  - name: version # Optional.
    value: 0.10.2.0
  - name: maxMessageBytes 
    value: 1024
  - name: caCert
    secretKeyRef:
      name: kafkainfra-0-tls
      key: ca.crt
auth:
  secretStore: app-secretstore

ibrahimsen avatar Oct 02 '23 17:10 ibrahimsen

meet the same issue.

ParrySMS avatar Dec 01 '23 10:12 ParrySMS

Same issue here. Any update?

callebjo avatar Jan 24 '24 17:01 callebjo

This issue should have/is been fixed in Dapr 1.12.3 Details can be found here: https://github.com/dapr/components-contrib/issues/3263

wimvc1 avatar Jan 26 '24 06:01 wimvc1