Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 80392 invoked from network); 26 Oct 2010 15:32:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Oct 2010 15:32:24 -0000 Received: (qmail 20031 invoked by uid 500); 26 Oct 2010 15:32:24 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 19892 invoked by uid 500); 26 Oct 2010 15:32:22 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 19884 invoked by uid 99); 26 Oct 2010 15:32:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Oct 2010 15:32:22 +0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of james.strachan@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Oct 2010 15:32:17 +0000 Received: by qyk8 with SMTP id 8so2823481qyk.11 for ; Tue, 26 Oct 2010 08:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=2fGx8gjxRm0gAOFWSUlMjCb8jDGcfgP8rg928ZCvW4g=; b=ZkY6HFlwMOnZQgfH3x2Nk67JmJCl0bp7F7eWXKNs/fpxw8KbiJWpnxzESq2OAhongD K4XjQ0+SwsAEQvzjfgsl0whoTVumZIaKndZNXRnuS6TDTDvIo2abVj5z4mWRX/SfCBvi 5LJk2dLINJvGUg5EuJdaquuOp+sNbELH7oZQI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=DIz0G4uSHPk4eLaUiw7an+AK6f4qQU6rLURtYIS92XtQxdL7KjMs7adhrv8GIEhLnZ l91NyicmWyprnFsPOqTx0epjXpTx4xxd2D5N7GxRg2Aup7ua3bpHpkUjHa/LLKLGgziC fHQLyneL9qsfD72HnZLJblrKspe/ET6IlVgkg= Received: by 10.229.102.11 with SMTP id e11mr7625861qco.276.1288107116520; Tue, 26 Oct 2010 08:31:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.36.203 with HTTP; Tue, 26 Oct 2010 08:31:36 -0700 (PDT) In-Reply-To: References: <1287955167004-3234703.post@n5.nabble.com> From: James Strachan Date: Tue, 26 Oct 2010 16:31:36 +0100 Message-ID: Subject: Re: Abstracting Routes using Components To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 On 26 October 2010 16:17, Hadrian Zbarcea wrote: > So the idea is to use route templates and in order to parameterized them use URIs the camel way. That's nice and consistent. There are a few different options here... i) a parameterized RouteBuilder which can be dependency injected using Spring/Java/Guice/whatever ii) a parameterized RouteBuilder which is dependency injected using a URI (which is kinda like Kristof's example code) iii) a ProtocolBuilder which is-a Component and is-a RouteBuilder so that the components URI namespace can be used to export 'global names' to its logical endpoints which map to internal Camel endpoints names used inside the routes. The ProtocolBuilder could even use a nested internal CamelContext to totally hide the implementation detail. Which is what I describe here... http://camel.465427.n5.nabble.com/implementing-Protocols-or-a-way-to-make-it-easier-to-black-box-routes-and-compose-them-with-other-ros-td3218777.html#a3218777 This idea would let a default Protocol have default endpoints "in", "out" and "err" for example. Each of these approaches have their own strengths and weaknesses, depending on what you are doing and if you need to 'wrap' or 'hide' implementation details or if you just want simple parameterization of a RouteBuilder class. If all you want is parametrization of a RouteBuilder then (i) or (ii) works great; just pick your preferred injection mechanism. (iii) is subtly different; its like taking some integration code as an implementation and packaging it up with a public interface for others to use inside other routes; hiding the implementation detail from the person doing the integration of this new component. With the customers I've talked to where (iii) is more relevant they have one team making a particular Protocol (a component which wraps a bunch of routing rules), then they have other teams take the various Protocols output by other teams and route them together. In this sense the Protocols become just a way to package up a collection of Routes into an easy to use form for others folks to use; rather like using Composition with Object Orientation to make an easy to use Facade on top of some implementation code. -- James ------- FuseSource Email: james@fusesource.com Web: http://fusesource.com Twitter: jstrachan Blog: http://macstrac.blogspot.com/ Open Source Integration