Claus Ibsen created CAMEL-27737:
-----------------------------------
Summary: camel-azure-eventgrid: same id for List events,
credentialType ignored, missing header labels
Key: CAMEL-27737
URL: https://issues.apache.org/jira/browse/CAMEL-27737
Project: Camel
Issue Type: Bug
Components: camel-azure
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-azure-eventgrid for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. A List body with the CamelAzureEventGridId header sends every event with
the same id
{{EventGridProducer.process()}} calls {{createCloudEvent()}} for each element
of a List body, and {{createCloudEvent()}} reads the {{CamelAzureEventGridId}}
header each time. When the header is set, all events of the batch get the same
id and the same source ({{/camel}}). In CloudEvents, source and id identify an
event, so a subscriber that deduplicates keeps only one of them.
Proposed: use the header id only for a single event, or make the id unique per
element (for example a suffix with the index), and document it.
h4. 2. The fallback to AZURE_IDENTITY in createEndpoint() never runs
{{EventGridComponent.createEndpoint()}} sets {{credentialType}} to
{{AZURE_IDENTITY}} when no credential option is set and {{getCredentialType()
== null}}. The option defaults to {{ACCESS_KEY}} and cannot be set to null from
the URI, so this branch is dead. Without accessKey, azureKeyCredential,
tokenCredential or {{credentialType=AZURE_IDENTITY}}, the endpoint fails with
"Azure EventGrid AccessKey, AzureKeyCredential, TokenCredential or Azure
Identity must be specified."
Proposed: remove the dead branch, or make AZURE_IDENTITY the fallback on
purpose (with an upgrade guide entry).
h4. 3. An explicit credentialType is overwritten by the credential options
In {{EventGridComponent.createEndpoint()}}, a set {{tokenCredential}} forces
{{TOKEN_CREDENTIAL}} (or {{AZURE_IDENTITY}}), and a set {{accessKey}} or
{{azureKeyCredential}} forces {{ACCESS_KEY}}, whatever {{credentialType}} the
user configured. For example {{credentialType=AZURE_IDENTITY&accessKey=...}}
authenticates with the access key, without a warning. The option only matters
for {{AZURE_IDENTITY}} with no credential option set.
Proposed: keep an explicitly configured credentialType and fail when its
credential is missing, or log a warning when a credential option overrides it.
h4. 4. With a component-level publisherClient the endpoint has no topicEndpoint
{{EventGridComponent.createEndpoint()}} copies the URI path into
{{topicEndpoint}} only when the component configuration has no
{{publisherClient}}. With a component-level client, {{topicEndpoint}} stays
empty, so {{EventGridEndpoint.getServiceUrl()}} and {{getServiceMetadata()}}
return null although the URI names the topic. With an endpoint-level
{{publisherClient}} the path is copied.
Proposed: always copy the path into topicEndpoint; the producer already ignores
it when a client is set.
h4. 5. The headers have no producer label
The four headers in {{EventGridConstants}} ({{CamelAzureEventGridEventType}},
{{CamelAzureEventGridSubject}}, {{CamelAzureEventGridEventTime}},
{{CamelAzureEventGridId}}) are read by the producer only, but their
{{@Metadata}} has no {{label = "producer"}}, so the catalog shows them without
a label.
Proposed: add {{label = "producer"}} to the four headers.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)