You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/02 18:04:37 UTC
[1/2] camel git commit: CAMEL-10075: Documentation - added code
sample in place of broken snippets
Repository: camel
Updated Branches:
refs/heads/master 00fef5857 -> 535aa3d0f
CAMEL-10075: Documentation - added code sample in place of broken snippets
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/535aa3d0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/535aa3d0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/535aa3d0
Branch: refs/heads/master
Commit: 535aa3d0fb11645199f76d81233e9277ca6e38ee
Parents: 2dc74c6
Author: Darius <da...@gmail.com>
Authored: Tue Aug 2 13:52:21 2016 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Aug 2 20:04:29 2016 +0200
----------------------------------------------------------------------
camel-core/src/main/docs/properties.adoc | 60 +++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/535aa3d0/camel-core/src/main/docs/properties.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/properties.adoc b/camel-core/src/main/docs/properties.adoc
index d67c159..e9ae443 100644
--- a/camel-core/src/main/docs/properties.adoc
+++ b/camel-core/src/main/docs/properties.adoc
@@ -532,6 +532,34 @@ which also offers a property placeholder service. Camel supports
convention over configuration, so all you have to do is to define the
OSGi Blueprint property placeholder in the XML file as shown below:
+[source]
+----
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- OSGI blueprint property placeholder -->
+ <cm:property-placeholder id="myblueprint.placeholder" persistent-id="camel.blueprint">
+ <!-- list some properties as needed -->
+ <cm:default-properties>
+ <cm:property name="result" value="mock:result"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <!-- in the route we can use {{ }} placeholders which will lookup in blueprint
+ as Camel will auto detect the OSGi blueprint property placeholder and use it -->
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:foo"/>
+ <to uri="{{result}}"/>
+ </route>
+ </camelContext>
+</blueprint>
+----
+
*Using OSGi blueprint property placeholders in Camel routes*
By default Camel detects and uses OSGi blueprint property placeholder
@@ -558,6 +586,38 @@ You can also explicit refer to a specific OSGi blueprint property
placeholder by its id. For that you need to use the Camel's
`<propertyPlaceholder>` as shown in the example below:
+[source]
+----
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- OSGI blueprint property placeholder -->
+ <cm:property-placeholder id="myblueprint.placeholder" persistent-id="camel.blueprint">
+ <!-- list some properties as needed -->
+ <cm:default-properties>
+ <cm:property name="prefix.result" value="mock:result"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <!-- using Camel properties component and refer to the blueprint property placeholder by its id -->
+ <propertyPlaceholder id="properties" location="blueprint:myblueprint.placeholder"
+ prefixToken="[[" suffixToken="]]"
+ propertyPrefix="prefix."/>
+
+ <!-- in the route we can use {{ }} placeholders which will lookup in blueprint -->
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:foo"/>
+ <to uri="[[result]]"/>
+ </route>
+ </camelContext>
+</blueprint>
+----
+
*Explicit referring to a OSGi blueprint placeholder in Camel*
Notice how we use the `blueprint` scheme to refer to the OSGi blueprint
[2/2] camel git commit: CAMEL-10077 Removed snippet from adoc
Posted by da...@apache.org.
CAMEL-10077 Removed snippet from adoc
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2dc74c6b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2dc74c6b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2dc74c6b
Branch: refs/heads/master
Commit: 2dc74c6be38cc12122d3288209e74ec316f993f9
Parents: 00fef58
Author: Darius <da...@gmail.com>
Authored: Tue Aug 2 13:21:33 2016 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Aug 2 20:04:29 2016 +0200
----------------------------------------------------------------------
camel-core/src/main/docs/file.adoc | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2dc74c6b/camel-core/src/main/docs/file.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/file.adoc b/camel-core/src/main/docs/file.adoc
index 0236e8c..8f92976 100644
--- a/camel-core/src/main/docs/file.adoc
+++ b/camel-core/src/main/docs/file.adoc
@@ -900,14 +900,36 @@ First we need a persistence-unit in `META-INF/persistence.xml` where we
need to use the class
`org.apache.camel.processor.idempotent.jpa.MessageProcessed` as model.
-Then we need to setup a Spring `jpaTemplate` in the spring XML file:
-
-Error formatting macro: snippet: java.lang.IndexOutOfBoundsException:
-Index: 20, Size: 20
+[source,xml]
+---------------------------------------------------------------------------------
+<persistence-unit name="idempotentDb" transaction-type="RESOURCE_LOCAL">
+ <class>org.apache.camel.processor.idempotent.jpa.MessageProcessed</class>
+
+ <properties>
+ <property name="openjpa.ConnectionURL" value="jdbc:derby:target/idempotentTest;create=true"/>
+ <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
+ <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
+ <property name="openjpa.Multithreaded" value="true"/>
+ </properties>
+</persistence-unit>
+---------------------------------------------------------------------------------
-And finally we can create our JPA idempotent repository in the spring
+Next, we can create our JPA idempotent repository in the spring
XML file as well:
+[source,xml]
+---------------------------------------------------------------------------------
+<!-- we define our jpa based idempotent repository we want to use in the file consumer -->
+<bean id="jpaStore" class="org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository">
+ <!-- Here we refer to the entityManagerFactory -->
+ <constructor-arg index="0" ref="entityManagerFactory"/>
+ <!-- This 2nd parameter is the name (= a category name).
+ You can have different repositories with different names -->
+ <constructor-arg index="1" value="FileConsumer"/>
+</bean>
+---------------------------------------------------------------------------------
+
And yes then we just need to refer to the *jpaStore* bean in the file
consumer endpoint using the `idempotentRepository` using the `#` syntax
option: