Author: buildbot Date: Wed May 15 11:19:07 2013 New Revision: 862058 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/defaulterrorhandler.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/defaulterrorhandler.html ============================================================================== --- websites/production/camel/content/defaulterrorhandler.html (original) +++ websites/production/camel/content/defaulterrorhandler.html Wed May 15 11:19:07 2013 @@ -76,36 +76,39 @@ <tr> <td valign="top" width="100%"> <div class="wiki-content maincontent"><h2><a shape="rect" name="DefaultErrorHandler-DefaultErrorHandler"></a>DefaultErrorHandler</h2> + <p>This is the new default error handler in Camel 2.0 onwards.</p> -<p>It has the same power as the <a shape="rect" href="dead-letter-channel.html" title="Dead Letter Channel">Dead Letter Channel</a> however it does <b>not</b> support a <em>dead letter queue</em>. That is the only difference between the two of them.</p> +<p>It has the same power as the <a shape="rect" href="dead-letter-channel.html" title="Dead Letter Channel">Dead Letter Channel</a>, however it does <b>not</b> support a <em>dead letter queue</em>, which is the only difference between the two of them.</p> -<p>The default error handler is configured differently that <a shape="rect" href="dead-letter-channel.html" title="Dead Letter Channel">Dead Letter Channel</a> as it configured to:</p> -<ul class="alternate" type="square"><li>no redeliver</li><li>not handled</li><li>no dead letter queue (not possible)</li></ul> +<p>The <a shape="rect" href="defaulterrorhandler.html" title="DefaultErrorHandler">DefaultErrorHandler</a> is configured differently that <a shape="rect" href="dead-letter-channel.html" title="Dead Letter Channel">Dead Letter Channel</a> as it is configured to:</p> +<ul class="alternate" type="square"><li>not redeliver</li><li>not handled</li><li>no dead letter queue (not possible)</li></ul> -<p>By default any exception thrown during routing will be propagated back to the caller and the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> ends immediately. However you can use the <a shape="rect" href="exception-clause.html" title="Exception Clause">Exception Clause</a> to catch a given exception and lower the exception by marking it as handled. If so the exception will <b>not</b> be sent back to the caller and the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> continues to be routed.</p> +<p>By default, any exception thrown during routing will be propagated back to the caller and the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> ends immediately. However, you can use the <a shape="rect" href="exception-clause.html" title="Exception Clause">Exception Clause</a> to catch a given exception and lower the exception by marking it as handled. If so, the exception will <b>not</b> be sent back to the caller, and the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> continues to be routed.</p> <h3><a shape="rect" name="DefaultErrorHandler-Example"></a>Example</h3> -<p>In this route below, any exception thrown in eg the <tt>validateOrder</tt> bean will be propagated back to the caller, and its the jetty endpoint. It will return a HTTP error message back to the client.</p> + +<p>In this route below, any exception thrown in, eg the <tt>validateOrder</tt> bean, will be propagated back to the caller via the jetty endpoint. It will return an HTTP error message back to the client.</p> + <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -from(<span class="code-quote">"jetty:http:<span class="code-comment">//localhost/myservice/order"</span>).to(<span class="code-quote">"bean:validateOrder"</span>).to(<span class="code-quote">"jms:queue:order"</span>);</span> +<pre class="code-java">from(<span class="code-quote">"jetty:http:<span class="code-comment">//localhost/myservice/order"</span>).to(<span class="code-quote">"bean:validateOrder"</span>).to(<span class="code-quote">"jms:queue:order"</span>);</span> </pre> </div></div> -<p>We can add a <b>onException</b> in case we want to catch certain exceptions and route them differently, for instance to catch a <b>ValidationException</b> and return a fixed response to the caller.</p> +<p>We can add an <b>onException</b> in case we want to catch certain exceptions and route them differently, for instance to catch a <b>ValidationException</b> and return a fixed response to the caller.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> -<pre class="code-java"> -onException(ValidationException.class).handled(<span class="code-keyword">true</span>).transform(body(constant(<span class="code-quote">"INVALID ORDER"</span>))); +<pre class="code-java">onException(ValidationException.class).handled(<span class="code-keyword">true</span>).transform(body(constant(<span class="code-quote">"INVALID ORDER"</span>))); from(<span class="code-quote">"jetty:http:<span class="code-comment">//localhost/myservice/order"</span>).to(<span class="code-quote">"bean:validateOrder"</span>).to(<span class="code-quote">"jms:queue:order"</span>);</span> </pre> </div></div> -<p>When the <b>ValidationException</b> is thrown from the validate order bean it is intercepted by the <a shape="rect" href="defaulterrorhandler.html" title="DefaultErrorHandler">DefaultErrorHandler</a> and it let the <tt>onException(ValidationException.class</tt> handle it so the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> is routed to this route and since we use <b>handled(true)</b> then the original exception is lowered (= cleared) and we transform the message into a fixed response that are returned to jetty endpoint that returns it to the original caller.</p> + +<p>When the <tt><b>ValidationException</b></tt> is thrown from the <tt>validateOrder</tt> bean, it is intercepted by the <a shape="rect" href="defaulterrorhandler.html" title="DefaultErrorHandler">DefaultErrorHandler</a> that lets the <tt>onException(ValidationException.class)</tt> handle it, so the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> is routed to this onException route, and since we use <tt>handled(true)</tt>, then the original exception is cleared, and we transform the message into a fixed response that is returned to jetty endpoint that returns it to the original caller.</p> <h3><a shape="rect" name="DefaultErrorHandler-SeeAlso"></a>See Also</h3> + <ul class="alternate" type="square"><li><a shape="rect" href="error-handler.html" title="Error Handler">Error Handler</a></li><li><a shape="rect" href="dead-letter-channel.html" title="Dead Letter Channel">Dead Letter Channel</a></li></ul> </div> </td>