rabbitmq / rabbitmq-stomp

RabbitMQ STOMP plugin
https://www.rabbitmq.com/stomp.html
Other
49 stars 28 forks source link

Request for enhancement: specifying consumer tags when subscribing #80

Closed spatula75 closed 8 years ago

spatula75 commented 8 years ago

Our use case is that we find it very helpful to include some details about the environment in which a consumer is running in the text of the cTag when we subscribe via AMQP, but there currently isn't a way to specify the cTag that should be used when subscribing via Stomp (or webstomp). (Today we use this so we can quickly see from the RabbitMQ Admin UI the time at which a consumer started, the internal name of the consumer process, the internal IP address where the process is running, etc.)

It would be really nice if we could include an X-consumer-tag header to specify the name we would like to use when the plugin subscribes to the queue on behalf of the Stomp subscriber, much in the same way that we can use X-queue-name today.

In the case of a name collision with an existing cTag, treating it as a subscription error would be fine with us, though others may have other ideas.

michaelklishin commented 8 years ago

@spatula75 you can use the id header to customise the consumer tag. It uses a fairly simple convention:

T_id='{id-header-value}'

I'm not sure how much value there would be in allowing the entire thing to be overridden. What do you think?

spatula75 commented 8 years ago

Actually, this does perfectly well for what we need. I had mistakenly thought that setting the ID header wasn't changing the consumer tag because of what I had previously been setting it to be (I used the wrong string and this made it look like an autogenerated value), but I see that it actually is changing it effectively. We're unaffected for our use case by its starting with T_id, so I'll close this as "already supported," and if someone ever has a need to customize the whole thing, I guess this can be referenced.

Thanks for the tip; all is well!