Claus Ibsen created CAMEL-26096:
-----------------------------------

             Summary: camel-aws2-msk - CamelAwsMSKBrokerNodesGroupInfo as text 
is dropped, and no operation fails with a NullPointerException
                 Key: CAMEL-26096
                 URL: https://issues.apache.org/jira/browse/CAMEL-26096
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of aws2-msk (CAMEL-24961).

h4. 1. No operation fails with a NullPointerException

The operation option has no default, and with no CamelAwsMSKOperation header, 
{{switch (determineOperation(exchange))}} ({{MSK2Producer}}, main ed3d719b379c, 
line 61) fails with {{NullPointerException: Cannot invoke "...ordinal()" 
because the return value of "...determineOperation(...)" is null}}. Checked on 
4.24.0-SNAPSHOT with {{camel run}} against the AWS emulator of {{camel infra 
run aws}}.

*Proposed change*: fail with a message that says to set the operation option or 
header, as aws2-kms does ("Operation must be specified").

h4. 2. CamelAwsMSKBrokerNodesGroupInfo as text is dropped

createCluster checks that the header is set, then reads it as a 
{{BrokerNodeGroupInfo}} of the AWS SDK ({{MSK2Producer}}, main ed3d719b379c, 
lines 188-191), which gives null for text, so the request goes out without it 
and Camel raises no error. Checked on 4.24.0-SNAPSHOT with {{camel run}} 
against the AWS emulator of {{camel infra run aws}}, through a proxy that logs 
the requests: with the header "kafka.m5.large" the request is 
{{\{"clusterName":"k2","kafkaVersion":"3.6.0","numberOfBrokerNodes":1\}}}.

h4. 3. With pojoRequest, createCluster and describeCluster set no headers

The ARN and the state of the cluster are set only when the request comes from 
headers (lines 204-205 and 281-282). Checked on 4.24.0-SNAPSHOT with {{camel 
run}} against the AWS emulator of {{camel infra run aws}}, through a proxy that 
logs the requests: describeCluster with a DescribeClusterRequest body gives no 
{{CamelAwsMSKClusterState}}.

h4. 4. The deleteCluster example of the page sets the headers of createCluster

The Java-only example "from("direct:deleteCluster")" 
({{aws2-msk-component.adoc}}, lines 176-187) sets the name, the Kafka version, 
the number of nodes and the node group, and calls deleteCluster, which reads 
only {{CamelAwsMSKClusterArn}} and fails with "Cluster ARN must be specified". 
The page also says listClusters lists "the available MSK Brokers" (line 77), 
and sets the ARN header to "test-kafka".

_Claude Code on behalf of davsclaus_



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

Reply via email to