Claus Ibsen created CAMEL-27701:
-----------------------------------

             Summary: camel-aws2-sns: unclear errors for missing or FIFO topic, 
extra ListTopics calls, doc error
                 Key: CAMEL-27701
                 URL: https://issues.apache.org/jira/browse/CAMEL-27701
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-aws2-sns for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/72814bce04a8161b53a88f44f88772f718679b38).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. The endpoint starts without a topic when the topic does not exist and 
autoCreateTopic is false
When the topic is given by name, {{Sns2Endpoint.doInit()}} looks up its ARN 
with {{ListTopics}}. If no topic matches and {{autoCreateTopic}} is false (the 
default), the endpoint starts with no topic ARN. Every publish then sends a 
{{PublishRequest}} without {{TopicArn}} and fails with an error of Amazon SNS 
about a missing parameter, which does not name the topic. With {{policy}} or 
{{subscribeSNStoSQS}} set, the start fails with the same unclear error.
Proposed change: fail at start with an error that names the topic and points to 
{{autoCreateTopic}}.

h4. 2. The topic lookup lists all pages after it found the topic
In {{Sns2Endpoint.doInit()}} the {{break}} after a match only leaves the 
{{for}} loop over the topics of one page. The {{do ... while (nextToken)}} loop 
goes on and calls {{ListTopics}} for every remaining page, which is slow in an 
account with many topics.
Proposed change: leave the outer loop too once the ARN is found.

h4. 3. A FIFO topic without messageGroupIdStrategy fails only at publish
{{messageGroupIdStrategy}} has no default. For a FIFO topic (name or ARN ending 
with {{.fifo}}), {{Sns2Producer.configureFifoAttributes()}} then sets no 
message group ID, and Amazon SNS rejects every publish, as it requires one for 
a FIFO topic. Nothing checks this at start.
Proposed change: fail at start when the topic is a FIFO topic and the option is 
not set, or default to {{useExchangeId}} for a FIFO topic.

h4. 4. The doc page says that the topic is created when it does not exist
{{aws2-sns-component.adoc}} says under "URI Format": "The topic will be created 
if they don't already exist." But {{autoCreateTopic}} defaults to false, and 
the section "Topic Auto-creation" of the same page says so.
Proposed change: remove the sentence, or say that the topic is created only 
with {{autoCreateTopic=true}}.

_Claude Code on behalf of davsclaus_



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

Reply via email to