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

Customize consumer tag #209

Closed
nico3dfx opened this issue Oct 6, 2022 · 2 comments
Closed

Customize consumer tag #209

nico3dfx opened this issue Oct 6, 2022 · 2 comments

Comments

@nico3dfx
Copy link

nico3dfx commented Oct 6, 2022

Hi,
in Rascal the consumer tag starts with "amq.ctag-*".

Is it possible to customize all or part of the name?

Thank you,
Nico.

@nico3dfx
Copy link
Author

nico3dfx commented Oct 6, 2022

The consumerTag key can be configured inside the single subscription:

"subscriptions": {
    "test123": {
          "queue": "test123_queue",
                "options": {
                    "consumerTag": "test123_ctag"
                }
            }
    }

Not present in json schema file but the key dosen't invalidate the config.

@cressie176
Copy link
Collaborator

Hi @nico3dfx,

in Rascal the consumer tag starts with "amq.ctag-*".

As you're no doubt aware, Rascal is a wrapper around amqplib, which is a RabbitMQ client, and therefore uses the AMQP 0.9.1 protocol. In the case of the consumer tag, it's actually RabbitMQ which will generate the value by default, unless the client provides one.

If you read the amqplib channel api consume documentation you will see this reiterated. However you can specify a consumerTag if you want to. When it comes to Rascal, there is usually an options object, which will be passed directly through to the equivalent amqplib function, both from config, and programmatically, with the latter taking precedence. e.g.

"subscriptions": {
  "test123": {
    "queue": "test123_queue",
      "options": {
        "consumerTag": "test123_ctag"
      }
    }
  }
} 
await subscription = broker.subscribe("s1", { consumerTag: "test123_ctag" })

In this case though I didn't include the property in the JSON schema, probably because it's I've never found a reason to hard code it. I don't think there will be an issue with setting as you have done though. I'll update the JSON schema accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants