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

fix: metadata capitalization #3413

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions bindings/azure/eventhubs/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ builtinAuthenticationProfiles:
entity management is enabled.
metadata:
# Input-only metadata
# consumerGroup is an alias for consumerId, if both are defined consumerId takes precedence.
- name: consumerId
# consumerGroup is an alias for consumerID, if both are defined consumerID takes precedence.
- name: consumerID
type: string
required: true # consumerGroup is an alias for this field, let's promote this to default
binding:
Expand All @@ -108,7 +108,7 @@ metadata:
output: false
description: |
The name of the Event Hubs Consumer Group to listen on.
Alias to consumerId.
Alias to consumerID.
example: '"group1"'
deprecated: true
- name: storageAccountKey
Expand Down
2 changes: 1 addition & 1 deletion pubsub/azure/eventhubs/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ metadata:
description: |
Storage container name.
example: '"myeventhubstoragecontainer"'
- name: consumerId
- name: consumerID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All our fields are case-insensitive. If you want to update the metadata.yaml and the docs, that's all that needs to change :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And additionally, keep in mind that metadata.yaml is not what controls the accepted values - this is just documentation.

Our Kit/Decode Metadata function which is based on mitchellh/mapstructure uses the WeakDecode function which accepts any casing. There are several other convenience features, which is why all metadata should always be specified as struct tags and then decoded using this special function.

Also FYI, consumerID is a special metadata which actually is NOT defined in components-contrib. This is hardcoded in Dapr runtime, so you might need to verify in that repo what casing is accepted. Unlike in contrib, they don't use our metadata handling code in runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, okay. Docs do reflect the changes I'm making here, so that works out great and will require no doc updates: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-eventhubs/

type: string
required: true # consumerGroup is an alias for this field, let's promote this to default
description: |
Expand Down
2 changes: 1 addition & 1 deletion pubsub/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ func (r *rabbitMQ) subscribeForever(ctx context.Context, req pubsub.SubscribeReq

msgs, err = channel.Consume(
q.Name,
queueName, // consumerId
queueName, // consumerID
r.metadata.AutoAck, // autoAck
false, // exclusive
false, // noLocal
Expand Down