Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribing to the same topic with different routing keys and endpoints #7737

Open
byteAbit0101 opened this issue May 16, 2024 · 0 comments
Open
Labels
kind/bug Something isn't working

Comments

@byteAbit0101
Copy link

byteAbit0101 commented May 16, 2024

In what area(s)?

/area runtime dapr

What version of Dapr?

1.12.4

Expected Behavior

I want to be able to subscribe to a topic twice with different routes and routing keys.

the exchange 'topica' should show 2 queues with different names and different routing keys and point to different routes

  • test-api-event-user-receiver
  • test-api-data-user-receiver

suggestion: the subscription metadata.name value should be used for the subscription/queue name to avoid naming conflicts on the queues.

Actual Behavior

Only one queue is getting created in the Rabbit-MQ exchange. The second one is missing.

I guess the issue is how subscriptions (= rabbit MQ queue attached to the exchange) get setup by dapr. The first subscription creates a queue with the name 'test-api-topica' (='{consumerID}-{exchangeName}') and the second one would try to setup a queue with the same name '{consumerID}-{exchangeName}' again.

Steps to Reproduce the Problem

  • RabbitMQ:
    • Version: 3.12.2
    • Exchange 'topica'>> durable - NO
  • Dapr
    • Version: 1.12.4
    • configuration:
      • pubsub.yaml
        apiVersion: dapr.io/v1alpha1
        kind: Component
        metadata:
          name: pubsub-a
        spec:
          type: pubsub.rabbitmq
          version: v1
          metadata:
          - name: consumerID
            value: "test-api"
          - name: connectionString
            value: {RABBIT-MQ-CONNECTION-STRING}
          - name: durable
            value: false
          - name: deletedWhenUnused
            value: false
          - name: autoAck
            value: false
          - name: deliveryMode
            value: 0
          - name: requeueInFailure
            value: false
          - name: prefetchCount
            value: 0
          - name: reconnectWait
            value: 5
          - name: concurrencyMode
            value: parallel
          - name: enableDeadLetter 
            value: false
          - name: exchangeKind
            value: topic
        
      • subscription.yaml
        apiVersion: dapr.io/v2alpha1
        kind: Subscription
        metadata:
          name: event-user-receiver
        spec:
          topic: topica
          routes: 
            default: /api/events/user
          pubsubname: pubsub-a
          metadata:
            routingKey: SYS.*.event.User.#
        scopes:
        - test-api
        
        ---
        
        apiVersion: dapr.io/v2alpha1
        kind: Subscription
        metadata:
          name: data-user-receiver
        spec:
          topic: topica
          routes: 
            default: /api/data/user
          pubsubname: pubsub-a
          metadata:
            routingKey: SYS.*.data.User.#
        scopes:
        - test-api
        

Release Note

RELEASE NOTE: FIX Multiple subscriptions on one topic with different routes and routingKeys

@byteAbit0101 byteAbit0101 added the kind/bug Something isn't working label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant