Author: buildbot Date: Mon Mar 7 11:18:54 2016 New Revision: 982066 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/how-do-i-configure-endpoints.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/how-do-i-configure-endpoints.html ============================================================================== --- websites/production/camel/content/how-do-i-configure-endpoints.html (original) +++ websites/production/camel/content/how-do-i-configure-endpoints.html Mon Mar 7 11:18:54 2016 @@ -88,9 +88,40 @@ <td valign="top" width="100%"> <div class="wiki-content maincontent"><h2 id="HowdoIconfigureendpoints-HowdoIconfigureendpoints?">How do I configure endpoints?</h2><p>There are a few different approaches to configuring components and endpoints.</p><h3 id="HowdoIconfigureendpoints-UsingJavaCode">Using Java Code</h3><p>You can explicitly configure a <a shape="rect" href="component.html">Component</a> using Java code as shown in this <a shape="rect" href="walk-through-an-example.html">example</a></p><p>Or you can explicitly get hold of an <a shape="rect" href="endpoint.html">Endpoint</a> and configure it using Java code as shown in the <a shape="rect" href="mock.html">Mock endpoint examples</a>.</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[SomeEndpoint endpoint = camelContext.getEndpoint("someURI", SomeEndpoint.class); -endpoint.setSomething("aValue"); -]]></script> -</div></div><h3 id="HowdoIconfigureendpoints-UsingGuice">Using Guice</h3><p>You can also use <a shape="rect" href="guice.html">Guice</a> as the dependency injection framework. For example see the <a shape="rect" href="guice-jms-example.html">Guice JMS Example</a></p><h3 id="HowdoIconfigureendpoints-UsingSpringXML">Using Spring XML</h3><p>You can configure your <a shape="rect" href="component.html">Component</a> or <a shape="rect" href="endpoint.html">Endpoint</a> instances in your <a shape="rect" href="spring.html">Spring</a> XML as follows.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +endpoint.setSomething("aValue");]]></script> +</div></div><h3 id="HowdoIconfigureendpoints-UsingCDI">Using CDI</h3><p>You can use <a shape="rect" href="cdi.html">CDI</a> as dependency injection framework to configure your <a shape="rect" href="component.html">Component</a> or <a shape="rect" href="endpoint.html">Endpoint</a> instances.</p><p>For example, to configure the SJMS component, you can declare a producer method in a CDI bean:</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[class MyCdiComponent { + + @PropertyInject("jms.maxConnections") + int maxConnections; + + @Produces + @Named("sjms") + @ApplicationScoped + SjmsComponent sjms() { + SjmsComponent component = new SjmsComponent(); + component.setConnectionFactory(new ActiveMQConnectionFactory("vm://broker?broker.persistent=false")); + component.setConnectionCount(maxConnections); + return component; + } +}]]></script> +</div></div><p>Then, the component is lazily looked-up by Camel CDI whenever it is referenced, e.g. from the Camel Java DSL:</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[class MyCdiRoute extends RouteBuilder { + + @Override + public void configure() { + from("sjms:sample.queue") + .log("Received message [${body}]"); + } +}]]></script> +</div></div><p>Besides, endpoints of that component can be injected in any CDI beans, e.g.:</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[class MyCdiBean { + + @Inject + @Uri("sjms:sample.queue") + Endpoint endpoint; +}]]></script> +</div></div><h3 id="HowdoIconfigureendpoints-UsingGuice">Using Guice</h3><p>You can also use <a shape="rect" href="guice.html">Guice</a> as the dependency injection framework. For example see the <a shape="rect" href="guice-jms-example.html">Guice JMS Example</a>.</p><h3 id="HowdoIconfigureendpoints-UsingSpringXML">Using Spring XML</h3><p>You can configure your <a shape="rect" href="component.html">Component</a> or <a shape="rect" href="endpoint.html">Endpoint</a> instances in your <a shape="rect" href="spring.html">Spring</a> XML as follows.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <jmxAgent id="agent" disabled="true"/> @@ -104,7 +135,7 @@ endpoint.setSomething("aValue" </property> </bean> ]]></script> -</div></div><p>Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using <strong>activemq:[queue:|topic:]destinationName</strong>. This works by the SpringCamelContext lazily fetching components from the spring context for the scheme name you use for <a shape="rect" href="endpoint.html">Endpoint</a> <a shape="rect" href="uris.html">URIs</a></p><h3 id="HowdoIconfigureendpoints-UsingEndpointURIs">Using Endpoint URIs</h3><p>Another approach is to use the URI syntax. The URI syntax supports the query notation. So for example with the <a shape="rect" href="mail.html">Mail</a> component you can configure the password property via the URI</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using <strong>activemq:[queue:|topic:]destinationName</strong>. This works by the SpringCamelContext lazily fetching components from the spring context for the scheme name you use for <a shape="rect" href="endpoint.html">Endpoint</a> <a shape="rect" href="uris.html">URIs</a><h3 id="HowdoIconfigureendpoints-UsingEndpointURIs">Using Endpoint URIs</h3><p>Another approach is to use the URI syntax. The URI syntax supports the query notation. So for example with the <a shape="rect" href="mail.html">Mail</a> component you can configure the password property via the URI</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[pop3://host:port?password=foo ]]></script> </div></div><h4 id="HowdoIconfigureendpoints-ReferringbeansfromEndpointURIs">Referring beans from Endpoint URIs</h4><p><strong>Available as of Camel 2.0</strong></p><p>When configuring endpoints using URI syntax you can now refer to beans in the <a shape="rect" href="registry.html">Registry</a> using the # notation.<br clear="none"> If the parameter value starts with a <code>#</code> sign then Camel will lookup in the <a shape="rect" href="registry.html">Registry</a> for a bean of the given type. For instance:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">