[CONF] Apache Camel Set up your IDE
Set up your IDE Page added by Carsten Ringe Import settings and templates Eclipse Install the checkstyle plugin via the Eclipse Marketplace Import checkstyle settings from etc/buildtools/src/main/resources/camel-checkstyle.xml Import the formatter from etc/eclipse/CamelCodeFormatter.xml Import code templates from etc/eclipse/camel_java_templates.xml, etc/eclipse/camel_xml_templates.xml, etc/eclipse/codetemplates.xml IntelliJ IDEA Import settings from etc/idea/settings.jar Stop watching space | Change email notification preferences View Online
svn commit: r885182 [1/2] - in /websites/production/camel/content: cache/main.pageCache set-up-your-ide.html sitemap.html
Author: buildbot Date: Sat Nov 2 09:18:59 2013 New Revision: 885182 Log: Production update by buildbot for camel Added: websites/production/camel/content/set-up-your-ide.html Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/sitemap.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Added: websites/production/camel/content/set-up-your-ide.html == --- websites/production/camel/content/set-up-your-ide.html (added) +++ websites/production/camel/content/set-up-your-ide.html Sat Nov 2 09:18:59 2013 @@ -0,0 +1,186 @@ +!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; +!-- + +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the License); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an AS IS BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +-- +html +head +link href=http://camel.apache.org/styles/site.css; rel=stylesheet type=text/css +link href=http://camel.apache.org/styles/type-settings.css; rel=stylesheet type=text/css +script src=http://camel.apache.org/styles/prototype.js; type=text/javascript/script +script src=http://camel.apache.org/styles/rico.js; type=text/javascript/script +script src=http://camel.apache.org/styles/site.js; type=text/javascript/script + +meta http-equiv=Content-type content=text/html;charset=UTF-8 + +style type=text/css + .maincontent { overflow:hidden; } +/style +!--[if IE] +style type=text/css + .maincontent { width:100%; } +/style +![endif]-- + + + +title +Apache Camel: Set up your IDE +/title +/head +body +div class=white_box +div class=header + div class=header_l +div class=header_r +/div + /div +/div +div class=content + div class=content_l +div class=content_r + div + !-- Banner -- +div id=banner-contentdiv id=asf_logo + div id=activemq_logo style=height:108px; background:transparent url(banner.data/apache-camel-7.png) no-repeat scroll left top; +a shape=rect style=float:left; width:310px;display:block;text-indent:-5000px;text-decoration:none;line-height:140px; margin-top:20px; margin-left:18px; href=http://camel.apache.org/;Camel/a +a shape=rect style=float:right; width:180px;display:block;text-indent:-5000px;text-decoration:none;line-height:80px; margin-top:45px; margin-right:10px; href=http://www.apache.org;Apache/a + /div +/div/div + !-- Banner -- +div class=top_red_bar + div id=site-breadcrumbs +!-- Breadcrumbs -- +a href=index.htmlApache Camel/anbsp;gt;nbsp;a href=developers.htmlDevelopers/anbsp;gt;nbsp;a href=set-up-your-ide.htmlSet up your IDE/a + /div + !-- Quicklinks -- +div id=site-quicklinkspa shape=rect href=download.html title=DownloadDownload/a | a shape=rect href=javadoc.html title=JavaDocJavaDoc/a | a shape=rect href=source.html title=SourceSource/a | a shape=rect href=discussion-forums.html title=Discussion ForumsForums/a | a shape=rect href=support.html title=SupportSupport/a/p/div + !-- Quicklinks -- +/div + + table border=0 + tbody +tr +td valign=top width=100% +div class=wiki-content maincontenth1a shape=rect name=SetupyourIDE-Importsettingsandtemplates/aImport settings and templates/h1 + +h2a shape=rect name=SetupyourIDE-Eclipse/aEclipse/h2 + +ulliInstall the a shape=rect class=external-link href=http://marketplace.eclipse.org/content/checkstyle-plug; rel=nofollowcheckstyle plugin/a via the Eclipse Marketplace/liliImport checkstyle settings from emetc/buildtools/src/main/resources/camel-checkstyle.xml/em/liliImport the formatter from emetc/eclipse/CamelCodeFormatter.xml/em/liliImport code templates from emetc/eclipse/camel_java_templates.xml/em, emetc/eclipse/camel_xml_templates.xml/em, emetc/eclipse/codetemplates.xml/em/li/ul + + +h2a shape=rect name=SetupyourIDE-IntelliJIDEA/aIntelliJ IDEA/h2 + +ulliImport settings from betc/idea/settings.jar/b/li/ul +/div +/td +td valign=top + div class=navigation +
git commit: Made SplunkEvent store field kvp's in Map instead of String
Updated Branches: refs/heads/master 6c881d53b - f8e9ead3d Made SplunkEvent store field kvp's in Map instead of String Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f8e9ead3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f8e9ead3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f8e9ead3 Branch: refs/heads/master Commit: f8e9ead3d7596c3533755b8a1a4070a3989b04b7 Parents: 6c881d5 Author: Preben Asmussen preben.asmus...@gmail.com Authored: Sat Nov 2 12:28:16 2013 +0100 Committer: Preben Asmussen preben.asmus...@gmail.com Committed: Sat Nov 2 12:28:16 2013 +0100 -- .../component/splunk/event/SplunkEvent.java | 65 ++-- .../camel/component/splunk/SplunkEventTest.java | 52 2 files changed, 71 insertions(+), 46 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f8e9ead3/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java -- diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java index 8bfcc6d..63c5cd1 100644 --- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java +++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/event/SplunkEvent.java @@ -18,7 +18,7 @@ package org.apache.camel.component.splunk.event; import java.io.Serializable; import java.util.Date; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import org.joda.time.format.DateTimeFormat; @@ -218,7 +218,7 @@ public class SplunkEvent implements Serializable { /** * Contents of the event message */ -private StringBuffer eventMessage; +private MapString, String event; /** * A Constructor to load data from a Map @@ -226,17 +226,14 @@ public class SplunkEvent implements Serializable { * @param data the map */ public SplunkEvent(MapString, String data) { -this.eventMessage = new StringBuffer(); -for (String key : data.keySet()) { -this.addPair(key, data.get(key)); -} +this.event = data; } /** * A Copy constructor */ public SplunkEvent(SplunkEvent splunkEvent) { -this.eventMessage = splunkEvent.eventMessage; +this.event = splunkEvent.getEventData(); this.quoteValues = splunkEvent.quoteValues; this.useInternalDate = splunkEvent.useInternalDate; } @@ -250,8 +247,7 @@ public class SplunkEvent implements Serializable { * @param quoteValues whether or not to put quotes around values */ public SplunkEvent(String eventName, String eventID, boolean useInternalDate, boolean quoteValues) { - -this.eventMessage = new StringBuffer(); +this.event = new LinkedHashMapString, String(); this.quoteValues = quoteValues; this.useInternalDate = useInternalDate; @@ -276,33 +272,11 @@ public class SplunkEvent implements Serializable { * Default constructor */ public SplunkEvent() { -this.eventMessage = new StringBuffer(); +this.event = new LinkedHashMapString, String(); } public MapString, String getEventData() { -MapString, String eventData = new HashMapString, String(); -String eventEntries = eventMessage.toString(); - -String[] entries = eventEntries.split(PAIRDELIM); - -String quote = new String(new char[] {QUOTE}); - -for (String entry : entries) { -String[] pair = entry.split(KVDELIM); - -if (pair.length != 2) { -throw new UnsupportedOperationException(String.format(invalid event data [%s], entry)); -} - -String key = pair[0].replaceAll(quote, ); -String value = pair[1].replaceAll(quote, ); -if (null.equals(value)) { -value = null; -} - -eventData.put(key, value); -} -return eventData; +return event; } /** @@ -398,11 +372,7 @@ public class SplunkEvent implements Serializable { * Add a key value pair */ public void addPair(String key, String value) { -if (quoteValues) { - this.eventMessage.append(key).append(KVDELIM).append(QUOTE).append(value).append(QUOTE).append(PAIRDELIM); -} else { - this.eventMessage.append(key).append(KVDELIM).append(value).append(PAIRDELIM); -} +this.event.put(key, value); } /** @@ -410,16 +380,19 @@ public class SplunkEvent implements Serializable { */
[CONF] Apache Camel Component List External
Component List External Page edited by Claus Ibsen Changes (1) ... broker:[queue|topic:]destinationName {code} | Apache | For internal message routing in the [ActiveMQ] broker using Camel.| | [ActiveMQ Journal] / activemq-core {code:xml} activemq.journal:directory-on-filesystem {code} | Apache | Uses ActiveMQs fast disk journaling implementation to store message bodies in a rolling log file | | [Activiti|http://www.activiti.org/] / activiti-camel {code:xml} ... Full Content Component / ArtifactId / URI License Description ActiveMQ / activemq-camel activemq:[queue|topic:]destinationName Apache For JMS Messaging with Apache ActiveMQ ActiveMQ Broker / activemq-camel broker:[queue|topic:]destinationName Apache For internal message routing in the ActiveMQ broker using Camel. Activiti / activiti-camel activiti:camelProcess:serviceTask Apache For working with Activiti, a light-weight workflow and Business Process Management (BPM) platform which supports BPMN 2 Db4o / camel-db4o in camel-extra db4o://className GPL For using a db4o datastore as a queue via the db4o library Esper / camel-esper in camel-extra esper:name GPL Working with the Esper Library for Event Stream Processing Hibernate / camel-hibernate in camel-extra hibernate://entityName GPL For using a database as a queue via the Hibernate library JBI / servicemix-camel jbi:serviceName Apache For JBI integration such as working with Apache ServiceMix JCIFS / camel-jcifs in camel-extra smb://u...@server.example.com/sharename?password=secretlocalWorkDirectory=/tmp LGPL This component provides access to remote file systems over the CIFS/SMB networking protocol by using the JCIFS library. JGroups / camel-jgroups in camel-extra jgroups://clusterName LGPL The jgroups: component provides exchange of messages between Camel infrastructure and JGroups clusters. NMR / servicemix-nmr nmr://serviceName Apache Integration with the Normalized Message Router BUS in ServiceMix 4.x RCode / camel-rcode in camel-extra rcode://host[:port]/operation[?options] LGPL Uses Rserve to integrate Camel with the statistics environment R Scalate / scalate-camel scalate:templateName Apache Uses the given Scalate template to transform the message Smooks / camel-smooks in camel-extra. unmarshal(edi) GPL For working with EDI parsing using the Smooks library. This component is deprecated as Smooks now provides Camel integration out of the box Spring Neo4j / camel-spring-neo4j in camel-extra spring-neo4j:http://hostname[:port]/database[?options] to bee clarified Component for producing to Neo4j datastore using the Spring Data Neo4j library VirtualBox / camel-virtualbox in camel-extra. virtualbox:machine[?options] GPL V2 The VitualBox component uses the webservice API that exposesVirtualBoxfunctionality and consumes events generated by virtual machines. ZeroMQ / camel-zeromq in camel-extra. zeromq:(tcp|ipc)://hostname:port LGPL The ZeroMQ component allows you to consumer or produce messages usingZeroMQ. Stop watching space | Change email notification preferences View Online | View Changes
[CONF] Apache Camel ActiveMQ Journal
ActiveMQ Journal Page removed by Claus Ibsen ActiveMQ Journal Component The ActiveMQ Journal Component allows messages to be stored in a rolling log file and then consumed from that log file. The journal aggregates and batches up concurrent writes so that the overhead of writing and waiting for the disk sync is relatively constant regardless of how many concurrent writes are being done. Therefore, this component supports and encourages you to use multiple concurrent producers to the same journal endpoint. Each journal endpoint uses a different log file and therefore write batching (and the associated performance boost) does not occur between multiple endpoints. This component only supports one active consumer on the endpoint. After the message is processed by the consumer's processor, the log file is marked and only subsequent messages in the log file will get delivered to consumers. URI format activemq.journal:directoryName[?options] So for example, to send to the journal located in the /tmp/data directory you would use the following URI: activemq.journal:/tmp/data Options Name Default Value Description syncConsume false If set to true, when the journal is marked after a message is consumed, wait till the Operating System has verified the mark update is safely stored on disk. syncProduce true If set to true, wait till the Operating System has verified the message is safely stored on disk. You can append query options to the URI in the following format, ?option=valueoption=value... Expected Exchange Data Types The consumer of a Journal endpoint generates DefaultExchange objects with the in message : header "journal" : set to the endpoint uri of the journal the message came from header "location" : set to a Location which identifies where the recored was stored on disk body : set to ByteSequence which contains the byte array data of the stored message The producer to a Journal endpoint expects an Exchange with an In message where the body can be converted to a ByteSequence or a byte[]. See Also Configuring Camel Component Endpoint Getting Started
svn commit: r885224 - in /websites/production/camel/content: activemq-journal.html book-architecture.html book-in-one-page.html cache/main.pageCache component-list-external.html component-list-grouped
Author: buildbot Date: Sat Nov 2 19:19:32 2013 New Revision: 885224 Log: Production update by buildbot for camel Removed: websites/production/camel/content/activemq-journal.html Modified: websites/production/camel/content/book-architecture.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/component-list-external.html websites/production/camel/content/component-list-grouped.html websites/production/camel/content/components.html websites/production/camel/content/transport.html websites/production/camel/content/uris.html Modified: websites/production/camel/content/book-architecture.html == --- websites/production/camel/content/book-architecture.html (original) +++ websites/production/camel/content/book-architecture.html Sat Nov 2 19:19:32 2013 @@ -894,12 +894,7 @@ activemq:[queue|topic:]destinationName script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ broker:[queue|topic:]destinationName ]]/script -/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd For internal message routing in the a shape=rect href=activemq.html title=ActiveMQActiveMQ/a broker using Camel./td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect href=activemq-journal.html title=ActiveMQ JournalActiveMQ Journal/a / activemq-core -div class=code panel style=border-width: 1px;div class=codeContent panelContent -script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ -activemq.journal:directory-on-filesystem -]]/script -/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd Uses ActiveMQ's fast disk journaling implementation to store message bodies in a rolling log file /td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect class=external-link href=http://www.activiti.org/; rel=nofollowActiviti/a / activiti-camel +/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd For internal message routing in the a shape=rect href=activemq.html title=ActiveMQActiveMQ/a broker using Camel./td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect class=external-link href=http://www.activiti.org/; rel=nofollowActiviti/a / activiti-camel div class=code panel style=border-width: 1px;div class=codeContent panelContent script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ activiti:camelProcess:serviceTask Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Sat Nov 2 19:19:32 2013 @@ -1308,12 +1308,7 @@ activemq:[queue|topic:]destinationName script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ broker:[queue|topic:]destinationName ]]/script -/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd For internal message routing in the a shape=rect href=activemq.html title=ActiveMQActiveMQ/a broker using Camel./td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect href=activemq-journal.html title=ActiveMQ JournalActiveMQ Journal/a / activemq-core -div class=code panel style=border-width: 1px;div class=codeContent panelContent -script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ -activemq.journal:directory-on-filesystem -]]/script -/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd Uses ActiveMQ's fast disk journaling implementation to store message bodies in a rolling log file /td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect class=external-link href=http://www.activiti.org/; rel=nofollowActiviti/a / activiti-camel +/div/div /tdtd colspan=1 rowspan=1 class=confluenceTd Apache /tdtd colspan=1 rowspan=1 class=confluenceTd For internal message routing in the a shape=rect href=activemq.html title=ActiveMQActiveMQ/a broker using Camel./td/trtrtd colspan=1 rowspan=1 class=confluenceTd a shape=rect class=external-link href=http://www.activiti.org/; rel=nofollowActiviti/a / activiti-camel div class=code panel style=border-width: 1px;div class=codeContent panelContent script class=theme: Default; brush: xml; gutter: false type=syntaxhighlighter![CDATA[ activiti:camelProcess:serviceTask @@ -21876,50 +21871,7 @@ droppable = false} h3a shape=rect name=BookInOnePage-SeeAlso/aSee Also/h3 ullia shape=rect href=configuring-camel.html title=Configuring CamelConfiguring Camel/a/lilia shape=rect href=component.html
[CONF] Apache Camel Spring Java Config
Spring Java Config Page edited by Henryk Konsek Comment: Deprecated JavaConfigContextLoader. See CAMEL-6917. Changes (12) ... Note that this library is totally optional; you could just wire Camel together yourself with Java Config. h3. Common cases h3. Configuration The most common case of using JavaConfig with Camel would be to create configuration with defined list of routes to be used by router. ... {code} h3. Other examples h3. Testing The following [example using Java Config|http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java] is actually a [Spring Testing] based unit test. Since *Camel 2.11.0* you can use the {{CamelSpringJUnit4ClassRunner}} with {{CamelSpringDelegatingTestContextLoader}}. This is the recommended way to test Java Config and Camel integration. {snippet:lang=java|id=example|url=""> {snippet:lang=java|id=example|url=""> The *@ContextConfiguration* annotation tells the [Spring Testing] framework to load the *ContextConfig* class as the configuration to use. This class derives from *SingleRouteCamelConfiguration* which is a helper Spring Java Config class which will configure the CamelContext for us and then register the RouteBuilder we create. If you wish to create a collection of *RouteBuilder* instances then derive from the *CamelConfiguration* helper class and implement the *routes()* method. Keep in mind that (starting from the Camel 2.13.0) if you dont override *routes()* method, then *CamelConfiguration* will use all *RouteBuilder* instances available in the Spring context. Since *Camel 2.11.0* you can use the CamelSpringJUnit4ClassRunner with CamelSpringDelegatingTestContextLoader like [example using Java Config with CamelSpringJUnit4ClassRunner|http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java]. The following [example using Java Config|http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java] demonstrates how to test Java Config integration with Camel 2.10 and lower. Keep in mind that {{JavaConfigContextLoader}} is deprecated and could be removed in the future versions of Camel on the behalf of the {{CamelSpringDelegatingTestContextLoader}}. {snippet:lang=java|id=example|url=""> {snippet:lang=java|id=example|url=""> The *@ContextConfiguration* annotation tells the [Spring Testing] framework to load the *ContextConfig* class as the configuration to use. This class derives from *SingleRouteCamelConfiguration* which is a helper Spring Java Config class which will configure the CamelContext for us and then register the RouteBuilder we create. Full Content Spring Java Config Spring started life using XML Config to wire beans together. However some folks don't like using XML and would rather use Java code which led to the creation of Guice along with the Spring JavaConfig project. You can use either the XML or Java config approachs with Camel; its your choice really on which you prefer. NOTE: From Camel 2.2.0 camel-spring-javaconfig is moved to Spring 3.x, which means you can't run it with spring 2.x. Using Spring Java Config To use Spring Java Config in your Camel project the easiest thing to do is add the following to your pom.xml dependency groupIdorg.apache.camel/groupId artifactIdcamel-spring-javaconfig/artifactId version${camel-version}/version /dependency This will then add the dependencies on the Spring JavaConfig library along with some helper classes for configuring Camel inside Spring. Note that this library is totally optional; you could just wire Camel together yourself with Java Config. Configuration The most common case of using JavaConfig with Camel would be to create configuration with defined list of routes to be used by router. @Configuration public class MyRouteConfiguration extends CamelConfiguration { @Autowire private MyRouteBuilder myRouteBuilder; @Autowire private MyAnotherRouteBuilder myAnotherRouteBuilder; @Override public ListRouteBuilder routes() { return Arrays.asList(myRouteBuilder, myAnotherRouteBuilder); } } Starting from Camel 2.13.0 you can skip the routes() definition, and fall back to the RouteBuilder instances located in the Spring context.
git commit: Added @Override and improved Javadoc.
Updated Branches: refs/heads/master f8e9ead3d - 4f639926e Added @Override and improved Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4f639926 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4f639926 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4f639926 Branch: refs/heads/master Commit: 4f639926efd8cdf1b4e33eb97014d87875ed984f Parents: f8e9ead Author: Henryk Konsek hekon...@gmail.com Authored: Sat Nov 2 22:51:18 2013 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Sat Nov 2 22:51:18 2013 +0100 -- .../camel/spring/javaconfig/SingleRouteCamelConfiguration.java | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4f639926/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/SingleRouteCamelConfiguration.java -- diff --git a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/SingleRouteCamelConfiguration.java b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/SingleRouteCamelConfiguration.java index 9ef9290..fd378ab 100644 --- a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/SingleRouteCamelConfiguration.java +++ b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/SingleRouteCamelConfiguration.java @@ -26,10 +26,12 @@ import org.springframework.context.annotation.Bean; * A useful base class for writing * a * href=http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-annotation-config; - * Spring annotation-based/a configurations to configure a CamelContext with a single {@link RouteBuilder} instance. + * Spring annotation-based/a configurations to configure a {@link org.apache.camel.CamelContext} with a single + * {@link RouteBuilder} instance. */ public abstract class SingleRouteCamelConfiguration extends CamelConfiguration { +@Override @Bean public ListRouteBuilder routes() { return Collections.singletonList(route()); @@ -39,4 +41,5 @@ public abstract class SingleRouteCamelConfiguration extends CamelConfiguration { * Creates the single {@link RouteBuilder} to use in this configuration */ public abstract RouteBuilder route(); + }
git commit: Improved Javadoc.
Updated Branches: refs/heads/master 4f639926e - e6059b49a Improved Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e6059b49 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e6059b49 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e6059b49 Branch: refs/heads/master Commit: e6059b49a7f514dd2ae5d6dfb36f8f63e5f60984 Parents: 4f63992 Author: Henryk Konsek hekon...@gmail.com Authored: Sat Nov 2 22:58:03 2013 +0100 Committer: Henryk Konsek hekon...@gmail.com Committed: Sat Nov 2 22:58:03 2013 +0100 -- .../apache/camel/spring/javaconfig/CamelConfiguration.java | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e6059b49/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java -- diff --git a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java index c6e5142..cf4d6e6 100644 --- a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java +++ b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java @@ -151,7 +151,13 @@ public abstract class CamelConfiguration implements BeanFactoryAware, Applicatio protected void setupCamelContext(CamelContext camelContext) throws Exception { } - + +/** + * Factory method returning {@link CamelContext} used by this configuration. + * + * @return {@link CamelContext} used by this configuration. By default {@link SpringCamelContext} instance is + * created, to fully integrate Spring application context and Camel registry. + */ protected CamelContext createCamelContext() throws Exception { return new SpringCamelContext(getApplicationContext()); }
svn commit: r885242 - in /websites/production/camel/content: cache/main.pageCache spring-java-config.html
Author: buildbot Date: Sat Nov 2 22:19:04 2013 New Revision: 885242 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/spring-java-config.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/spring-java-config.html == --- websites/production/camel/content/spring-java-config.html (original) +++ websites/production/camel/content/spring-java-config.html Sat Nov 2 22:19:04 2013 @@ -111,7 +111,7 @@ pNote that this library is totally optional; you could just wire Camel together yourself with Java Config./p -h3a shape=rect name=SpringJavaConfig-Commoncases/aCommon cases/h3 +h3a shape=rect name=SpringJavaConfig-Configuration/aConfiguration/h3 pThe most common case of using JavaConfig with Camel would be to create configuration with defined list of routes to be used by router./p @@ -146,9 +146,64 @@ public class MyRouteConfiguration extend ]]/script /div/div -h3a shape=rect name=SpringJavaConfig-Otherexamples/aOther examples/h3 +h3a shape=rect name=SpringJavaConfig-Testing/aTesting/h3 -pThe following a shape=rect class=external-link href=http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java;example using Java Config/a is actually a a shape=rect href=spring-testing.html title=Spring TestingSpring Testing/a based unit test./p +pSince bCamel 2.11.0/b you can use the ttCamelSpringJUnit4ClassRunner/tt with ttCamelSpringDelegatingTestContextLoader/tt. This is the recommended way to test Java Config and Camel integration./p + +div class=code panel style=border-width: 1px;div class=codeContent panelContent +script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[ +@RunWith(CamelSpringJUnit4ClassRunner.class) +@ContextConfiguration( +classes = {CamelSpringDelegatingTestContextLoaderTest.TestConfig.class}, +// Since Camel 2.11.0 +loader = CamelSpringDelegatingTestContextLoader.class +) +@MockEndpoints +public class CamelSpringDelegatingTestContextLoaderTest { +@EndpointInject(uri = mock:direct:end) +protected MockEndpoint endEndpoint; + +@EndpointInject(uri = mock:direct:error) +protected MockEndpoint errorEndpoint; + +@Produce(uri = direct:test) +protected ProducerTemplate testProducer; + +@Configuration +public static class TestConfig extends SingleRouteCamelConfiguration { +@Bean +@Override +public RouteBuilder route() { +return new RouteBuilder() { +@Override +public void configure() throws Exception { + from(direct:test).errorHandler(deadLetterChannel(direct:error)).to(direct:end); + +from(direct:error).log(Received message on direct:error endpoint.); + +from(direct:end).log(Received message on direct:end endpoint.); +} +}; +} +} + +@Test +public void testRoute() throws InterruptedException { +endEndpoint.expectedMessageCount(1); +errorEndpoint.expectedMessageCount(0); + +testProducer.sendBody(lt;namegt;testlt;/namegt;); + +endEndpoint.assertIsSatisfied(); +errorEndpoint.assertIsSatisfied(); +} +} +]]/script +/div/div + +pIf you wish to create a collection of bRouteBuilder/b instances then derive from the bCamelConfiguration/b helper class and implement the broutes()/b method. Keep in mind that (starting from the Camel 2.13.0) if you don't override broutes()/b method, then bCamelConfiguration/b will use all bRouteBuilder/b instances available in the Spring context./p + +pThe following a shape=rect class=external-link href=http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java;example using Java Config/a demonstrates how to test Java Config integration with Camel 2.10 and lower. Keep in mind that ttJavaConfigContextLoader/tt is deprecated and could be removed in the future versions of Camel on the behalf of the ttCamelSpringDelegatingTestContextLoader/tt./p div class=code panel style=border-width: 1px;div class=codeContent panelContent script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[ @@ -200,61 +255,7 @@ public class FilterTest extends Abstract ]]/script /div/div -pThe b@ContextConfiguration/b annotation tells the a shape=rect href=spring-testing.html title=Spring TestingSpring Testing/a framework to load the bContextConfig/b class as the configuration to use. This class derives from