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

AMQContentHeader toString uses dashes instead of underscores for property names #148

Open
ddewaele opened this issue May 29, 2016 · 2 comments

Comments

@ddewaele
Copy link

The com.rabbitmq.client.impl.AMQContentHeader has the following toString implementation

    @Override public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("#contentHeader<").append(getClassName()).append(">");
        this.appendPropertyDebugStringTo(sb);
        return sb.toString();
    }

It generates strings like this

#contentHeader<basic>(content-type=application/json, content-encoding=UTF-8, headers={topic=DOWNLOAD_AND_INSTALL, content-type=application/json, type=EVENT, tenant=DEFAULT, __TypeId__=org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest, thingId=new_device}, delivery-mode=2, priority=0, correlation-id=null, reply-to=null, expiration=null, message-id=null, timestamp=null, type=null, user-id=null, app-id=null, cluster-id=null)

This could make believe that content-type, content-encoding,..... are "valid" AMQP properties, while in fact RabbitMQ states :

Invalid properties will be ignored. Valid properties are:

content_type
content_encoding
priority
correlation_id
reply_to
expiration
message_id
timestamp
type
user_id
app_id
cluster_id

Notice the difference between the dash (-) and the ('_underscore')

To avoid confusion, the java client should print the "official" property names using underscores.

@ddewaele ddewaele changed the title com.rabbitmq.client.AMQP.BasicProperties toString com.rabbitmq.client.impl.AMQContentHeader toString uses dashes instead of underscores for property names May 29, 2016
@michaelklishin michaelklishin changed the title com.rabbitmq.client.impl.AMQContentHeader toString uses dashes instead of underscores for property names AMQContentHeader toString uses dashes instead of underscores for property names May 29, 2016
@michaelklishin
Copy link
Member

Property naming is in part language specific. I'm OK with outputting them the way they are expected to be provided somewhere else (I'm guessing in the management UI?) but underscores in names are expected in some languages and not expected in others.

@ddewaele
Copy link
Author

I understand. but to toString implies that these are the property key/value pairs that are set on the AMQContentHeader (part of the message).

By using dashes it only adds to the confusion (I think the dash notation isn't used anywhere else).

This toString output is also not really java language specific. It should denote the content of the AMQContentHeader IMHO.

stream-iori pushed a commit to stream-iori/rabbitmq-java-client that referenced this issue Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants