Author: buildbot
Date: Tue Dec 8 16:19:45 2015
New Revision: 974983
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/writing-components.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/writing-components.html
==============================================================================
--- websites/production/camel/content/writing-components.html (original)
+++ websites/production/camel/content/writing-components.html Tue Dec 8
16:19:45 2015
@@ -84,64 +84,11 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2
id="WritingComponents-WritingComponents">Writing Components</h2>
-
-<p>Apache Camel is designed to make it very easy to drop in new components
whether they be routing components, transformers, transports etc. The idea of a
component is to be a factory and manager of <a shape="rect"
href="endpoint.html">Endpoints</a>.</p>
-
-<p>Here are the main steps to writing a component.</p>
-
-<ul><li>write a POJO which implements the <a shape="rect"
class="external-link"
href="http://activemq.apache.org/camel/maven/current/camel-core/apidocs/org/apache/camel/Component.html">Component</a>
interface. The simplest approach is just to derive from <a shape="rect"
class="external-link"
href="http://activemq.apache.org/camel/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultComponent.html">DefaultComponent</a></li><li>to
support auto-discovery of your component add a file to
<em>META-INF/services/org/apache/camel/component/FOO</em> where FOO is the URI
scheme for your component and any related endpoints created on the fly. The
latter file should contain the definition of the component class. For example
if your component is implemented by the <em>com.example.CustomComponent</em>
class, the service file should contain the following line -
<em>class=com.example.CustomComponent</em> .</li></ul>
-
-
-<p>Users can then either explicitly create your component, configure it and
register with a <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html">CamelContext</a>
or users can use a URI which auto-creates your component.</p>
-
-<h3 id="WritingComponents-WritingEndpoints">Writing Endpoints</h3>
-
-<p>When implementing an <a shape="rect" href="endpoint.html">Endpoint</a> you
typically may implement one or more of the following methods</p>
-<ul><li><a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createProducer()">createProducer()</a>
will create a <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Producer.html">Producer</a>
for sending message exchanges to the endpoint</li><li><a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">createConsumer()</a>
implements the <a shape="rect" href="event-driven-consumer.html">Event Driven
Consumer</a> pattern for consuming message exchanges from the endpoint via a <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Processor.html">Processor</a>
when creating a <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-
core/apidocs/org/apache/camel/Consumer.html">Consumer</a></li><li><a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>
implements the <a shape="rect" href="polling-consumer.html">Polling
Consumer</a> pattern for consuming message exchanges from the endpoint via a <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html">PollingConsumer</a></li></ul>
-
-
-<p>Typically you just derive from <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultEndpoint.html">DefaultEndpoint</a>
and implement the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createProducer()">createProducer()</a>
and / or <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">createConsumer()</a>
methods. The <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>
method will be created by default for you in the <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultEndpoint.html">DefaultEndp
oint</a> class.</p>
-
-<p>If your endpoint is a polling-centric component you can derive from <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultPollingEndpoint.html">DefaultPollingEndpoint</a>
and then implement <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>;
the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">createConsumer()</a>
method will be created for you which avoids you having to write any polling
code.</p>
-
-<h3 id="WritingComponents-AnnotatingyourEndpoint">Annotating your Endpoint</h3>
-
-<p>As of <strong>Camel 2.12</strong> if you want to benefit from the automatic
generation of HTML documentation for all the parameters on your endpoint as
part of the maven site reports, you need to <a shape="rect"
href="endpoint-annotations.html">annotate your Endpoint's parameters</a>.</p>
-
-<p>So this means you add a @UriEndpoint annotation to your Endpoint class and
then annotate each parameter you wish to be configured via the URI
configuration mechanism with @UriParam (or @UriParams for nested configuration
objects).</p>
-
-<p>In addition its recommended that your Component implementation inherit from
the UriEndpointComponent base class as that means your Component will
automatically generate better metadata for the <a shape="rect"
href="componentconfiguration.html">ComponentConfiguration</a> API.</p>
-
-<p>Refer to the <a shape="rect" href="endpoint-annotations.html">Endpoint
Annotations guide for details</a>.</p>
-
-<h3 id="WritingComponents-UsingaProcessor">Using a Processor</h3>
-
-<p>If you are writing a simple endpoint which just processes messages in some
way, you can just implement a <a shape="rect"
href="processor.html">Processor</a> and <a shape="rect"
href="processor.html">use that to create an endpoint</a>.</p>
-
-<h3 id="WritingComponents-Dependencyinjectionandauto-discovery">Dependency
injection and auto-discovery</h3>
-
-<p>When using auto-discovery the CamelContext will default to its <a
shape="rect" href="injector.html">Injector</a> implementation to inject any
required or optional dependencies on the component. This allows you to use
auto-discovery of components via <a shape="rect" href="uris.html">URIs</a>
while still getting the benefits of dependency injection.</p>
-
-<p>For example your component can depend on a JDBC DataSource or JMS
ConnectionFactory which can be provided in the ApplicationContext in Spring or
Module in Guice.</p>
-
-<p>So you can if you prefer configure your Component using an IoC framework
like Spring or Guice; then add it to the CamelContext. Or you can let the
Component auto-inject itself as the endpoints are auto-discovered.</p>
-
-<h3 id="WritingComponents-Options">Options</h3>
-
-<p>If your component has options you can let it have public getters/setters
and Camel will automatically set the properties when the endpoint is created.
If you however want to take the matter in your own hands, then you must remove
the option from the given parameter list as Camel will validate that all
options are used. If not Camel will throw a ResolveEndpointFailedException
stating some of the options are unknown.</p>
-
-<p>The parameters is provided by Camel in the createEndpoint method from
DefaultComponent:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
-protected abstract Endpoint<E> createEndpoint(String uri, String
remaining, Map parameters)
+<div class="wiki-content maincontent"><h2
id="WritingComponents-WritingComponents">Writing Components</h2><p>Apache Camel
is designed to make it very easy to drop in new components whether they be
routing components, transformers, transports etc. The idea of a component is to
be a factory and manager of <a shape="rect"
href="endpoint.html">Endpoints</a>.</p><p>Here are the main steps to writing a
component.</p><ul><li>write a POJO which implements the <a shape="rect"
class="external-link"
href="http://activemq.apache.org/camel/maven/current/camel-core/apidocs/org/apache/camel/Component.html">Component</a>
interface. The simplest approach is just to derive from <a shape="rect"
class="external-link"
href="http://activemq.apache.org/camel/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultComponent.html">DefaultComponent</a></li><li>to
support auto-discovery of your component add a file to
<em>META-INF/services/org/apache/camel/component/FOO</em> where FOO is the URI
scheme
for your component and any related endpoints created on the fly. The latter
file should contain the definition of the component class. For example if your
component is implemented by the <em>com.example.CustomComponent</em> class, the
service file should contain the following line -
<em>class=com.example.CustomComponent</em> .</li></ul><p>Users can then either
explicitly create your component, configure it and register with a <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html">CamelContext</a>
or users can use a URI which auto-creates your component.</p><h3
id="WritingComponents-WritingEndpoints">Writing Endpoints</h3><p>When
implementing an <a shape="rect" href="endpoint.html">Endpoint</a> you typically
may implement one or more of the following methods</p><ul><li><a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#crea
teProducer()">createProducer()</a> will create a <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Producer.html">Producer</a>
for sending message exchanges to the endpoint</li><li><a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">createConsumer()</a>
implements the <a shape="rect" href="event-driven-consumer.html">Event Driven
Consumer</a> pattern for consuming message exchanges from the endpoint via a <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Processor.html">Processor</a>
when creating a <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Consumer.html">Consumer</a></li><li><a
shape="rect" class="external-link" href="http://camel.apache.org/maven/curr
ent/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>
implements the <a shape="rect" href="polling-consumer.html">Polling
Consumer</a> pattern for consuming message exchanges from the endpoint via a <a
shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html">PollingConsumer</a></li></ul><p>Typically
you just derive from <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultEndpoint.html">DefaultEndpoint</a>
and implement the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createProducer()">createProducer()</a>
and / or <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">cre
ateConsumer()</a> methods. The <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>
method will be created by default for you in the <a shape="rect"
class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultEndpoint.html">DefaultEndpoint</a>
class.</p><p>If your endpoint is a polling-centric component you can derive
from <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/DefaultPollingEndpoint.html">DefaultPollingEndpoint</a>
and then implement <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()">createPollingConsumer()</a>;
the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apido
cs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)">createConsumer()</a>
method will be created for you which avoids you having to write any polling
code.</p><h3 id="WritingComponents-AnnotatingyourEndpoint">Annotating your
Endpoint</h3><p>As of <strong>Camel 2.12</strong> if you want to benefit from
the automatic generation of HTML documentation for all the parameters on your
endpoint as part of the maven site reports, you need to <a shape="rect"
href="endpoint-annotations.html">annotate your Endpoint's
parameters</a>.</p><p>So this means you add a @UriEndpoint annotation to your
Endpoint class and then annotate each parameter you wish to be configured via
the URI configuration mechanism with @UriParam (or @UriParams for nested
configuration objects).</p><p>In addition its recommended that your Component
implementation inherit from the UriEndpointComponent base class as that means
your Component will automatically generate better metadata for the <a shape=
"rect" href="componentconfiguration.html">ComponentConfiguration</a>
API.</p><p>Refer to the <a shape="rect"
href="endpoint-annotations.html">Endpoint Annotations guide for
details</a>.</p><h3 id="WritingComponents-UsingaProcessor">Using a
Processor</h3><p>If you are writing a simple endpoint which just processes
messages in some way, you can just implement a <a shape="rect"
href="processor.html">Processor</a> and <a shape="rect"
href="processor.html">use that to create an endpoint</a>.</p><h3
id="WritingComponents-Dependencyinjectionandauto-discovery">Dependency
injection and auto-discovery</h3><p>When using auto-discovery the CamelContext
will default to its <a shape="rect" href="injector.html">Injector</a>
implementation to inject any required or optional dependencies on the
component. This allows you to use auto-discovery of components via <a
shape="rect" href="uris.html">URIs</a> while still getting the benefits of
dependency injection.</p><p>For example your component can depe
nd on a JDBC DataSource or JMS ConnectionFactory which can be provided in the
ApplicationContext in Spring or Module in Guice.</p><p>So you can if you prefer
configure your Component using an IoC framework like Spring or Guice; then add
it to the CamelContext. Or you can let the Component auto-inject itself as the
endpoints are auto-discovered.</p><h3
id="WritingComponents-Options">Options</h3><p>If your component has options you
can let it have public getters/setters and Camel will automatically set the
properties when the endpoint is created. If you however want to take the matter
in your own hands, then you must remove the option from the given parameter
list as Camel will validate that all options are used. If not Camel will throw
a ResolveEndpointFailedException stating some of the options are
unknown.</p><p>The parameters is provided by Camel in the createEndpoint method
from DefaultComponent:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent pa
nelContent pdl">
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[protected abstract Endpoint<E>
createEndpoint(String uri, String remaining, Map parameters)
]]></script>
-</div></div>
-
-<p>The code is an example from the SEDA component that removes the size
parameter:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
- public BlockingQueue<Exchange> createQueue(String uri, Map
parameters) {
+</div></div><p>The code is an example from the SEDA component that removes the
size parameter:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[ public BlockingQueue<Exchange>
createQueue(String uri, Map parameters) {
int size = 1000;
Object value = parameters.remove("size");
if (value != null) {
@@ -153,11 +100,7 @@ protected abstract Endpoint<E> cre
return new LinkedBlockingQueue<Exchange>(size);
}
]]></script>
-</div></div>
-
-<h3 id="WritingComponents-SeeAlso">See Also</h3>
-
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring
Camel</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a
shape="rect" href="component.html">Component</a></li></ul></div>
+</div></div><h3 id="WritingComponents-SeeAlso">See Also</h3><ul><li><a
shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a
shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect"
href="component.html">Component</a></li><li><a shape="rect"
class="external-link"
href="http://camel.apache.org/creating-a-new-camel-component.html">Creating a
new Camel Component with Maven</a></li></ul></div>
</td>
<td valign="top">
<div class="navigation">