You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/09/02 17:32:00 UTC

[jira] [Resolved] (CAMEL-16006) Improve ProducerTemplate documentation and code examples using ProducerTemplate

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

Claus Ibsen resolved CAMEL-16006.
---------------------------------
    Resolution: Won't Fix

> Improve ProducerTemplate documentation and code examples using ProducerTemplate
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-16006
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16006
>             Project: Camel
>          Issue Type: Improvement
>          Components: documentation
>    Affects Versions: 3.7.0
>            Reporter: Thomas Küstermann
>            Priority: Minor
>
> I'm currently reading about error handling in Camel, specifically [Using a Processor as a failure handler|https://camel.apache.org/manual/latest/exception-clause.html#ExceptionClause-UsingaProcessorasaFailureHandler].
> The code example lists
> {code:java|title=Code Example}
> // send it to our mock endpoint
> exchange.getContext().createProducerTemplate().send("mock:myerror", exchange);
> {code}
> According to the Javadoc of {{createProducerTemplate()}} and {{ProducerTemplate}} this is problematic:
> * {{stop()}} must be called when the {{ProducerTemplate}} is not further needed
> * Recommended practice is to use just one {{ProducerTemplate}} in the application
> * [Why does Camel use too many threads with ProducerTemplate?|https://camel.apache.org/manual/latest/faq/why-does-camel-use-too-many-threads-with-producertemplate.html]
> Since we're all lazy devs, we tend to copy paste code listings and think we're done.
> I suggest the following:
> * Add a section _Recommended Practice_ to [user manual ProducerTemplate|https://camel.apache.org/manual/latest/producertemplate.html] which basically lists the important bits of FAQ article [Why does Camel use too many threads with ProducerTemplate?|https://camel.apache.org/manual/latest/faq/why-does-camel-use-too-many-threads-with-producertemplate.html]
> * Fix code example in [Using a Processor as a failure handler|https://camel.apache.org/manual/latest/exception-clause.html#ExceptionClause-UsingaProcessorasaFailureHandler].
> * Maybe scan through other code samples?



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