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

Can't create pull consumer from cli #1056

Closed
withinboredom opened this issue May 12, 2024 · 10 comments
Closed

Can't create pull consumer from cli #1056

withinboredom opened this issue May 12, 2024 · 10 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@withinboredom
Copy link

withinboredom commented May 12, 2024

Observed behavior

Unless I'm just missing something obvious, it appears as though you cannot use the cli to create a pull consumer, as it fails with:

nats: error: Consumer creation failed: filtered consumer not unique on workqueue stream (10100)

Expected behavior

A pull consumer to be created.

Server and client version

server: v2.10.14
client: 0.1.4

Host environment

5 node cluster

Steps to reproduce

I first applied the stream:

# cat stream.json
{
        "name": "swytch",
        "subjects": ["swytch.>"],
        "retention": "workqueue",
        "storage": "file",
        "allow_rollup_hdrs": false,
        "deny_delete": true,
        "deny_purge": true,
        "num_replicas": 5
}
# nats str add --config stream.json
 # cat test.json
{
  "ack_policy": "explicit",
  "ack_wait": 300000000000,
  "durable_name": "swytch-activity",
  "filter_subject": "swytch.activity.>"
}
# nats consumer add --config test.json
nats: error: Consumer creation failed: filtered consumer not unique on workqueue stream (10100)

When created via an SDK with the exact same json, a consumer is created successfully.

@withinboredom withinboredom added the defect Suspected defect such as a bug or regression label May 12, 2024
@ripienaar
Copy link
Collaborator

The problem isn’t the pull consumer per se but the fact that work queue streams only allow one consumer to consume any subject.

So the error indicates you are trying to add a consumer that would clash with an existing one

@withinboredom
Copy link
Author

the error indicates you are trying to add a consumer that would clash with an existing one

@ripienaar, what existing one? There are no consumers to clash with.

@ripienaar
Copy link
Collaborator

Show “nats s info” please

@withinboredom
Copy link
Author

Information for Stream swytch created 2024-05-12 00:18:53

              Subjects: swytch.>
              Replicas: 5
               Storage: File

Options:

             Retention: WorkQueue
       Acknowledgments: true
        Discard Policy: Old
      Duplicate Window: 2m0s
     Allows Msg Delete: false
          Allows Purge: false
        Allows Rollups: false

Limits:

      Maximum Messages: unlimited
   Maximum Per Subject: unlimited
         Maximum Bytes: unlimited
           Maximum Age: unlimited
  Maximum Message Size: unlimited
     Maximum Consumers: unlimited

Cluster Information:

                  Name: nats
                Leader: nats-3
               Replica: nats-0, current, seen 889ms ago
               Replica: nats-1, current, seen 889ms ago
               Replica: nats-2, current, seen 889ms ago
               Replica: nats-4, current, seen 889ms ago

State:

              Messages: 0
                 Bytes: 0 B
        First Sequence: 0
         Last Sequence: 0
      Active Consumers: 0
            Alternates:         swytch: Cluster: nats
                        swytch_history: Cluster: nats

@withinboredom
Copy link
Author

Hmm, maybe the mirror counts as a consumer, which is weird, because when created via SDK, it works fine.

Information for Stream swytch_history created 2024-05-11 23:44:01

              Replicas: 5
               Storage: File

Options:

             Retention: Limits
       Acknowledgments: true
        Discard Policy: Old
      Duplicate Window: 0s
            Direct Get: true
     Mirror Direct Get: true
     Allows Msg Delete: true
          Allows Purge: true
        Allows Rollups: true

Limits:

      Maximum Messages: unlimited
   Maximum Per Subject: unlimited
         Maximum Bytes: unlimited
           Maximum Age: 7d0h0m0s
  Maximum Message Size: unlimited
     Maximum Consumers: unlimited

Replication:

                Mirror: swytch

Cluster Information:

                  Name: nats
                Leader: nats-2
               Replica: nats-0, current, seen 498ms ago
               Replica: nats-1, current, seen 498ms ago
               Replica: nats-3, current, seen 498ms ago
               Replica: nats-4, current, seen 497ms ago

Mirror Information:

           Stream Name: swytch
                   Lag: 0
             Last Seen: 464ms

State:

              Messages: 0
                 Bytes: 0 B
        First Sequence: 0
         Last Sequence: 0
      Active Consumers: 0

@ripienaar
Copy link
Collaborator

Could be yeah. Making a mirror of a WQ is probably not really a good idea. Try without the mirror?

@withinboredom
Copy link
Author

Yep, that was it

@withinboredom
Copy link
Author

Adding the mirror after the consumers works fine via cli.

@ripienaar
Copy link
Collaborator

What server version?

@withinboredom
Copy link
Author

It's in the initial issue report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants