Modified: websites/production/camel/content/download.html ============================================================================== --- websites/production/camel/content/download.html (original) +++ websites/production/camel/content/download.html Wed Apr 18 13:20:15 2012 @@ -81,7 +81,7 @@

Grab these releases while they are hot!

- +
@@ -96,14 +96,14 @@

Binary Distribution

-
DescriptionDownload LinkPGP Signature file of downloadMD5 Checksum file of downloadSHA1 Checksum file of download
Windows Distribution apache-camel-2.9.1.zip apache-camel-2.9.1.zip.asc apache-camel-2.9.1.zip.md5 apache-camel-2.9.1.zip.sha1
Unix/Linux/Cygwin Distribution apache-camel-2.9.1.tar.gz apache-camel-2.9.1.tar.gz.asc apache-camel-2.9.1.tar.gz.md5 apache-camel-2.9.1.tar.gz.sha1
Windows Distribution (2.8.x branch) apache-camel-2.8.4.zip apache-camel-2.8.4.zip.asc apache-camel-2.8.4.zip.md5 apache-camel-2.8.4.zip.sha1
Unix/Linux/Cygwin Distribution (2.8.x branch) apache-camel-2.8.4.tar.gz apache-camel-2.8.4.tar.gz.asc apache-camel-2.8.4.tar.gz.md5 apache-camel-2.8.4.tar.gz.sha1
Windows Distribution (2.7.x branch) apache-camel-2.7.5.zip apache-camel-2.7.5.zip.asc apache-camel-2.7.5.zip.md5 apache-camel-2.7.5.zip.sha1
Unix/Linux/Cygwin Distribution (2.7.x branch) apache-camel-2.7.5.tar.gz apache-camel-2.7.5.tar.gz.asc apache-camel-2.7.5.tar.gz.md5 apache-camel-2.7.5.tar.gz.sha1
+
DescriptionDownload LinkPGP Signature file of downloadMD5 Checksum file of downloadSHA1 Checksum file of download
Windows Distribution apache-camel-2.9.2.zip apache-camel-2.9.2.zip.asc apache-camel-2.9.2.zip.md5 apache-camel-2.9.2.zip.sha1
Unix/Linux/Cygwin Distribution apache-camel-2.9.2.tar.gz apache-camel-2.9.2.tar.gz.asc apache-camel-2.9.2.tar.gz.md5 apache-camel-2.9.2.tar.gz.sha1
Windows Distribution (2.8.x branch) apache-camel-2.8.4.zip apache-camel-2.8.4.zip.asc apache-camel-2.8.4.zip.md5 apache-camel-2.8.4.zip.sha1
Unix/Linux/Cygwin Distribution (2.8.x branch) apache-camel-2.8.4.tar.gz apache-camel-2.8.4.tar.gz.asc apache-camel-2.8.4.tar.gz.md5 apache-camel-2.8.4.tar.gz.sha1
Windows Distribution (2.7.x branch) apache-camel-2.7.5.zip apache-camel-2.7.5.zip.asc apache-camel-2.7.5.zip.md5 apache-camel-2.7.5.zip.sha1
Unix/Linux/Cygwin Distribution (2.7.x branch) apache-camel-2.7.5.tar.gz apache-camel-2.7.5.tar.gz.asc apache-camel-2.7.5.tar.gz.md5 apache-camel-2.7.5.tar.gz.sha1

Source Distribution

-
DescriptionDownload LinkPGP Signature file of downloadMD5 Checksum file of downloadSHA1 Checksum file of download
Source (zip - 2.9.x branch) apache-camel-2.9.1-src.zip apache-camel-2.9.1-src.zip.asc apache-camel-2.9.1-src.zip.md5 apache-camel-2.9.1-src.zip.sha1
Source (zip - 2.8.x branch) apache-camel-2.8.4-src.zip apache-camel-2.8.4-src.zip.asc apache-camel-2.8.4-src.zip.md5 apache-camel-2.8.4-src.zip.sha1
Source (zip - 2.7.x branch) apache-camel-2.7.5-src.zip apache-camel-2.7.5-src.zip.asc apache-camel-2.7.5-src.zip.md5 apache-camel-2.7.5-src.zip.sha1
+
DescriptionDownload LinkPGP Signature file of downloadMD5 Checksum file of downloadSHA1 Checksum file of download
Source (zip - 2.9.x branch) apache-camel-2.9.2-src.zip apache-camel-2.9.2-src.zip.asc apache-camel-2.9.2-src.zip.md5 apache-camel-2.9.2-src.zip.sha1
Source (zip - 2.8.x branch) apache-camel-2.8.4-src.zip apache-camel-2.8.4-src.zip.asc apache-camel-2.8.4-src.zip.md5 apache-camel-2.8.4-src.zip.sha1
Source (zip - 2.7.x branch) apache-camel-2.7.5-src.zip apache-camel-2.7.5-src.zip.asc apache-camel-2.7.5-src.zip.md5 apache-camel-2.7.5-src.zip.sha1
@@ -119,7 +119,7 @@ <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> - <version>2.9.1</version> + <version>2.9.2</version> </dependency> Modified: websites/production/camel/content/dynamic-router.html ============================================================================== --- websites/production/camel/content/dynamic-router.html (original) +++ websites/production/camel/content/dynamic-router.html Wed Apr 18 13:20:15 2012 @@ -105,7 +105,7 @@
from("direct:start")
     // use a bean as the dynamic router
-    .dynamicRouter(bean(DynamicRouterTest.class, "slip"));
+    .dynamicRouter(method(DynamicRouterTest.class, "slip"));
 
@@ -138,7 +138,48 @@ -

Mind that this example is only for show and tell. The current implementation is not thread safe. You would have to store the state on the Exchange, to ensure thread safety.

+

Mind that this example is only for show and tell. The current implementation is not thread safe. You would have to store the state on the Exchange, to ensure thread safety, as shown below:

+
+
/**
+ * Use this method to compute dynamic where we should route next.
+ *
+ * @param body the message body
+ * @param properties the exchange properties where we can store state between invocations
+ * @return endpoints to go, or <tt>null</tt> to indicate the end
+ */
+public String slip(String body, @Properties Map<String, Object> properties) {
+    bodies.add(body);
+
+    // get the state from the exchange properties and keep track how many times
+    // we have been invoked
+    int invoked = 0;
+    Object current = properties.get("invoked");
+    if (current != null) {
+        invoked = Integer.valueOf(current.toString());
+    }
+    invoked++;
+    // and store the state back on the properties
+    properties.put("invoked", invoked);
+
+    if (invoked == 1) {
+        return "mock:a";
+    } else if (invoked == 2) {
+        return "mock:b,mock:c";
+    } else if (invoked == 3) {
+        return "direct:foo";
+    } else if (invoked == 4) {
+        return "mock:result";
+    }
+
+    // no more so return null
+    return null;
+}
+
+
+ +

You could also store state as message headers, but they are not guaranteed to be preserved during routing, where as properties on the Exchange are. Although there was a bug in the method call expression, see the warning below.

+ +
Using beans to store state
Mind that in Camel 2.9.2 or older, when using a Bean the state is not propagated, so you will have to use a Processor instead. This is fixed in Camel 2.9.3 onwards.

Spring XML

The same example in Spring XML would be:

Added: websites/production/camel/content/why-do-my-file-consumer-not-pickup-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.html ============================================================================== --- websites/production/camel/content/why-do-my-file-consumer-not-pickup-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.html (added) +++ websites/production/camel/content/why-do-my-file-consumer-not-pickup-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.html Wed Apr 18 13:20:15 2012 @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + Apache Camel: Why do my file consumer not pickup the file, and how do I let the file consumer use the Camel error handler + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + +
+

Why do my file consumer not pickup the file, and how do I let the file consumer use the Camel error handler

+ +

There could be several reasons why the File consumer is not picking up files. For example it may not run at all, or it cannot acquire a read lock on the file.
+Check the logs to see if you can see any exceptions / messages being logged. You can turn on DEBUG logging at org.apache.camel.component.file to see more details.

+ +

How to use the Camel error handler with the file consumer

+ +

Well this is really a chicken and egg questions. The Camel error handler (eg in the routes) does only apply when a message is being routed by the routing engine.
+Before this happens a consumer must successfully receive a message, and created a Camel Exchange, and populate the Exchange with message details (eg body and headers), and then pass the Exchange to the routing engine. Only at this point the routing error handler can deal with exceptions occurring. Before this point, any error handling is really Component specific.

+ +

If the component consumer extends the DefaultConsumer from Camel, then this consumer offers a org.apache.camel.spi.ExceptionHandler the component can use to allow a hook for end users to plugin their custom implementation. The default implementation from Camel is LoggingExceptionHandler that will log the exception at ERROR/WARN level, and then ignore the exception.

+ +

See the File page in the bottom for an example how to use a custom ExceptionHandler that sends a new message to the Camel routing engine, that then allows the routing engine to trigger its error handling to deal with the exception.

+
+ +
+ + +
+
+
+
+
+
+ +
+
+
+© 2004-2011 The Apache Software Foundation. +
+Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+Graphic Design By Hiram +
+ + + + + + + +