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

shashank reassigned CAMEL-26331:
--------------------------------

    Assignee: shashank

> camel-core - one hook for every send to an endpoint, that can stop, delay or 
> change the send
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26331
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26331
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: shashank
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Every send to an endpoint in Camel goes through one of six places, the places 
> that fire the {{ExchangeSendingEvent}}:
> * {{SendProcessor}} ({{to}})
> * {{DefaultProducerCache}}, two places, and {{EventNotifierCallback}} 
> ({{toD}}, enrich, routingSlip, ProducerTemplate)
> * {{MulticastProcessor}} (recipientList)
> * {{EventNotifierProducer}} (deferred producers)
> No component fires the event itself. The six places repeat the same code: 
> fire the sending event, start a StopWatch, call the producer, fire the sent 
> event.
> *Proposal*
> * Move this code into one helper that the six places call.
> * Give the helper a hook (an SPI) that runs before and after the producer. 
> Before the send, the hook can stop it (it sets an exception, and the producer 
> is not called), delay it or change the message. After the send, it can change 
> the reply.
> * With no hook installed, the cost is one check, like the event check that 
> these places do today.
> * For a send from a route, the hook runs inside the error handler. So a 
> stopped send is a real failure for {{onException}}, redelivery and the dead 
> letter channel.
> *Why not what exists today*
> * An event notifier sees every send, but it cannot stop one: the exception of 
> a notifier is logged and ignored, and the producer is called anyway.
> * interceptSendToEndpoint can stop a send, but it wraps the endpoints and 
> adds processors to the routes.
> * Wrapping the component, as {{camel run --stub}} does, changes its type. A 
> {{KafkaComponent}} is then a wrapper for {{getComponent("kafka", 
> KafkaComponent.class)}}, the component options, the dev consoles and the 
> health checks.
> *First user*
> camel-chaos (CAMEL-26330): fail, delay or change any send while the 
> application runs, without changing the components or the routes. The hook is 
> general, so other developer tools can use it too.
> _Filed by Claude Code on behalf of davsclaus_



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

Reply via email to