Ben Campion created CAMEL-16586:
-----------------------------------

             Summary: camel-aws2-sns: messages for different endpoints are 
published to the same topic
                 Key: CAMEL-16586
                 URL: https://issues.apache.org/jira/browse/CAMEL-16586
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.9.0, 3.7.4
            Reporter: Ben Campion


Endpoints are created sharing the same mutable {{Configuration}} object and the 
topic name (or ARN) stored in this object is updated each time a new endpoint 
is created. This results in messages intended for one endpoint being sent to 
the topic name (or ARN) for the most recently created endpoint.

I think this might be a regression introduced by CAMEL-15840.

Here is an example of a failing unit test for {{SnsComponentConfigurationTest}} 
to demonstrate the problem:
{code:java}
@Test
public void createMultipleEndpoints() throws Exception {
    Sns2Component component = context.getComponent("aws2-sns", 
Sns2Component.class);
    
    Sns2Endpoint endpoint1 = (Sns2Endpoint) 
component.createEndpoint("aws2-sns://Topic1?accessKey=xxx&secretKey=yyy");
    assertEquals("Topic1", endpoint1.getConfiguration().getTopicName());
    
    Sns2Endpoint endpoint2 = (Sns2Endpoint) 
component.createEndpoint("aws2-sns://Topic2?accessKey=xxx&secretKey=yyy");
    assertEquals("Topic2", endpoint2.getConfiguration().getTopicName());
    
    // this now fails because endpoint1 and endpoint2 share the same config
    assertEquals("Topic1", endpoint1.getConfiguration().getTopicName());
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to