[ 
https://issues.apache.org/jira/browse/CAMEL-27645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27645:
--------------------------------
    Fix Version/s: 4.25.0
                       (was: 4.24.0)

> camel-azure-storage-queue: credentialType fallback, silent 404 poll, metadata 
> defaults
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27645
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27645
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-azure
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-azure-storage-queue 
> for CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/c1712ed79b7bb3ff4d4ecf5c6e33cd658b4b7a7f).
> These are separate problems of the component; the descriptions commit only 
> documents the current behavior.
> h4. 1. An unsupported credentialType silently uses DefaultAzureCredential
> {{QueueClientFactory.createQueueServiceClient()}} handles 
> {{SHARED_KEY_CREDENTIAL}} and {{SHARED_ACCOUNT_KEY}}, and sends every other 
> value to the {{else}} branch, which uses {{DefaultAzureCredential}}. The 
> option lists only three values in {{enums}}, but the endpoint configurer 
> accepts any {{CredentialType}}, for example {{AZURE_SAS}} or 
> {{CONNECTION_STRING}}. The user sees no error, and the client authenticates 
> with Azure Identity instead of what was configured.
> Proposed change: use {{DefaultAzureCredential}} only for {{AZURE_IDENTITY}} 
> and fail with an {{IllegalArgumentException}} for any other unsupported type.
> h4. 2. The consumer reports nothing when the queue does not exist
> {{QueueConsumer.poll()}} catches a {{QueueStorageException}} with status code 
> 404 and returns 0. When the queue of the endpoint does not exist, or its name 
> is misspelled, the consumer polls forever without an error or a log line.
> Proposed change: log a WARN (once, or with the poll) that the queue does not 
> exist, or let the exception reach the poll strategy so that the error handler 
> and the health check see it.
> h4. 3. SHARED_ACCOUNT_KEY and SHARED_KEY_CREDENTIAL behave the same
> In {{QueueClientFactory.createQueueServiceClient()}} both types call 
> {{getCredentialForClient()}}, which uses the {{credentials}} option if it is 
> set and otherwise {{accountName}} with {{accessKey}}. 
> {{QueueComponent.createEndpoint()}} sets {{SHARED_KEY_CREDENTIAL}} when 
> {{credentials}} is set and {{credentialType}} is not, while the metadata 
> declares {{defaultValue = "SHARED_ACCOUNT_KEY"}}. The choice between the two 
> types has no effect, and the documented default is not always the one used.
> Proposed change: decide whether the two types should differ (for example 
> {{SHARED_KEY_CREDENTIAL}} requiring {{credentials}}), and make the metadata 
> default match the code.
> h4. 4. QueueComponent.checkCredentials() is never called
> The private method {{QueueComponent.checkCredentials()}} looks up a single 
> {{StorageSharedKeyCredential}} in the registry, but nothing calls it. The 
> {{@Metadata(autowired = true)}} on {{credentials}} already does this lookup.
> Proposed change: remove the method.
> h4. 5. operation has no defaultValue in the metadata
> {{QueueConfiguration.operation}} is initialized to 
> {{QueueOperationDefinition.sendMessage}}, and {{QueueProducer.process()}} 
> also falls back to {{sendMessage}}. The {{@UriParam}} has no 
> {{defaultValue}}, so the catalog and the docs show no default.
> Proposed change: add {{defaultValue = "sendMessage"}}.
> h4. 6. accountName is required but not marked as required
> {{QueueComponent.createEndpoint()}} throws {{IllegalArgumentException("At 
> least the account name must be specified.")}} when the path is empty, also 
> when {{serviceClient}} is set. The {{@UriPath}} of {{accountName}} has no 
> {{required = true}}.
> Proposed change: mark {{accountName}} as required in the metadata.
> h4. 7. The header CamelAzureStorageQueuePopReceipt has only the producer label
> {{QueueConsumer.createExchange()}} sets {{CamelAzureStorageQueuePopReceipt}} 
> for each message it receives, and the producer reads it for deleteMessage and 
> updateMessage. The {{@Metadata}} in {{QueueConstants.POP_RECEIPT}} has 
> {{label = "producer"}}, so the docs do not list it as a consumer header.
> Proposed change: remove the label (or use {{consumer,producer}}), like 
> {{CamelAzureStorageQueueMessageId}}, which has no label.
> h4. 8. The doc page says the queue is always created
> {{azure-storage-queue-component.adoc}} says "The queue will be created if it 
> does not already exist." Only sendMessage with {{createQueue=true}} creates 
> the queue ({{QueueOperations.sendMessage()}}); the consumer and the other 
> operations do not. The heading "*Required information options:*" also appears 
> twice.
> Proposed change: say that the queue is created only by sendMessage with 
> {{createQueue=true}}, and remove the duplicate heading.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to