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 2010/05/12 10:33:46 UTC

svn commit: r943408 - in /camel/trunk: components/camel-http/src/main/java/org/apache/camel/component/http/ components/camel-jetty/src/main/java/org/apache/camel/component/jetty/ examples/camel-example-loadbalancing-mina/

Author: davsclaus
Date: Wed May 12 08:33:46 2010
New Revision: 943408

URL: http://svn.apache.org/viewvc?rev=943408&view=rev
Log:
Polishing

Modified:
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
    camel/trunk/examples/camel-example-loadbalancing-mina/README.txt

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?rev=943408&r1=943407&r2=943408&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java Wed May 12 08:33:46 2010
@@ -27,6 +27,8 @@ import javax.servlet.http.HttpServletRes
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.impl.DefaultExchange;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Revision$
@@ -34,6 +36,7 @@ import org.apache.camel.impl.DefaultExch
 public class CamelServlet extends HttpServlet {
 
     private static final long serialVersionUID = -7061982839117697829L;
+    private static final transient Log LOG = LogFactory.getLog(CamelServlet.class);
 
     private ConcurrentHashMap<String, HttpConsumer> consumers = new ConcurrentHashMap<String, HttpConsumer>();
    
@@ -54,24 +57,21 @@ public class CamelServlet extends HttpSe
                 return;
             }
 
-            // Have the camel process the HTTP exchange.
-            DefaultExchange exchange = new DefaultExchange(consumer.getEndpoint(), ExchangePattern.InOut);
-            if (((HttpEndpoint)consumer.getEndpoint()).isBridgeEndpoint()) {
+            // create exchange and set data on it
+            Exchange exchange = new DefaultExchange(consumer.getEndpoint(), ExchangePattern.InOut);
+            if ((consumer.getEndpoint()).isBridgeEndpoint()) {
                 exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
             }
             exchange.setIn(new HttpMessage(exchange, request, response));
-            consumer.getProcessor().process(exchange);
 
-            // HC: The getBinding() is interesting because it illustrates the
-            // impedance miss-match between
-            // HTTP's stream oriented protocol, and Camels more message oriented
-            // protocol exchanges.
+            // Have the camel process the HTTP exchange.
+            consumer.getProcessor().process(exchange);
 
             // now lets output to the response
             consumer.getBinding().writeResponse(exchange, response);
 
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("Error processing request", e);
             throw new ServletException(e);
         }
     }

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java?rev=943408&r1=943407&r2=943408&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java (original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java Wed May 12 08:33:46 2010
@@ -29,11 +29,15 @@ import org.eclipse.jetty.continuation.Co
 import org.eclipse.jetty.continuation.ContinuationSupport;
 
 /**
+ * Currently not in use.
+ *
  * @version $Revision$
  */
 public class CamelContinuationServlet extends CamelServlet {
 
-    // TODO: should use the new Async API and allow end users to define if they want Jetty continuation support or not
+    // TODO: We should look into what we can do to introduce back Jetty Continuations
+    // and it should be documented how it works and to be used
+    // and end users should be able to decide if they want to leverage it or not
 
     private static final long serialVersionUID = 1L;
         

Modified: camel/trunk/examples/camel-example-loadbalancing-mina/README.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/README.txt?rev=943408&r1=943407&r2=943408&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-loadbalancing-mina/README.txt (original)
+++ camel/trunk/examples/camel-example-loadbalancing-mina/README.txt Wed May 12 08:33:46 2010
@@ -1,18 +1,23 @@
-Loadbalancing with MINA Example
-===============================
+Load balancing with MINA Example
+================================
 
 This example show how you can easily use the camel-mina component to design a solution allowing to distribute message 
 workload on several servers. Those servers are simple TCP/IP servers created by the Apache MINA framework and running in
 separate Java Virtual Machine. The loadbalancer pattern of Camel which is used top of them allows to send in a Round Robin model
-mode the messages created from a camel-bean component respectively to each server running on localhost:9999 and localhost:9998.
+mode the messages created from a camel Bean component respectively to each server running on localhost:9999 and localhost:9998.
 MINA has been configured to send over the wire objects serialized and this is what is showed also in this example.
-The advantage of this apporach is that you don't need to use CORBA or Java RMI for the communication between the different jvm.
+The advantage of this approach is that you don't need to use CORBA or Java RMI for the communication between the different JVMs.
 The example has been configured to use InOut EIP pattern.
 
 The demo starts when every one minute, a Report object is created from the camel loadbalancer server. This object is send by the 
 camel loadbalancer to a MINA server and object is serialized. One of the two MINA servers (localhost:9999 and localhost:9998) receives
 the object and enrich it by setting the field reply of the Report object. The reply is send back by the MINA server to the camel loadbalancer 
-who will display in its log  the content of the Report object. 
+who will display in its log the content of the Report object. 
+
+
+For the latest & greatest documentation on how to use this example please see 
+  http://camel.apache.org/loadbalacing-mina.html
+
 
 1. Description of the routes 
 ============================
@@ -31,9 +36,7 @@ who will display in its log  the content
 <bean id="service" class="org.apache.camel.example.service.Generator"/> 
 
 <camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
-    <package>
-        com.intuit.ai.step.camel 
-    </package>
+
     <route id="sendMessage">
     	<from uri="timer://org.apache.camel.example.loadbalancer?fixedRate=true&amp;period=60000"/>
     	<bean ref="service" method="createReport"/>
@@ -150,22 +153,14 @@ and check the result in the log of loadb
 >> Report reply : Report updated from MINA server running on : localhost:9999
 >> ***********************************************
 ]
-
 ...
 
 
+If you hit an problems please let us know on the Camel Forums
+  http://camel.apache.org/discussion-forums.html
 
+Please help us make Apache Camel better - we appreciate any feedback you may
+have.  Enjoy!
 
-
-
-
-
-
-
-
-
-
-
-
-Enjoy it
-
+------------------------
+The Camel riders!