Gaelle Fournier created CAMEL-24408:
---------------------------------------

             Summary: SEDA discardIfNoConsumers breaks after consumer removal 
when sharing the same URI
                 Key: CAMEL-24408
                 URL: https://issues.apache.org/jira/browse/CAMEL-24408
             Project: Camel
          Issue Type: Bug
          Components: camel-seda
    Affects Versions: 4.22.0, 4.19.0
            Reporter: Gaelle Fournier


When a SEDA producer and consumer share the same endpoint URI, removing the 
consumer route destroys the shared queue state. Subsequent sends throw 
SedaConsumerNotAvailableException instead of silently discarding as 
{{discardIfNoConsumers=true}} specifies. The exchange is discarded correctly 
before a consumer is ever added, but not after one is removed.

The root cause seems to be in {{SedaComponent.onShutdownEndpoint() }}. It 
checks {{endpoint.getConsumers().isEmpty() }}before tearing down the queue, but 
does not check for active producers. Since the producer and consumer resolve to 
the same {{SedaEndpoint}} instance, the {{QueueReference}} is removed entirely. 
{{SedaProducer.addToQueue()}} then gets a null queue and throws before the 
{{discardIfNoConsumers}} check  is reached.

See: 
https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/Question.20about.20SedaConsumerNotAvailableException/with/617246614



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to