Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13A1810D69 for ; Fri, 22 Nov 2013 15:38:57 +0000 (UTC) Received: (qmail 20782 invoked by uid 500); 22 Nov 2013 15:38:50 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 20608 invoked by uid 500); 22 Nov 2013 15:38:38 -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 20567 invoked by uid 99); 22 Nov 2013 15:38:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 15:38:36 +0000 X-ASF-Spam-Status: No, hits=0.9 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URIBL_RHS_DOB,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.172 as permitted sender) Received: from [209.85.223.172] (HELO mail-ie0-f172.google.com) (209.85.223.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 15:38:32 +0000 Received: by mail-ie0-f172.google.com with SMTP id qd12so2316541ieb.31 for ; Fri, 22 Nov 2013 07:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=TphSmhexxSFA7nyHkszY9FMxzO5J3xma+6VNAlSJHis=; b=MKbfJZ0DxNkYy24Uufw+ie/BoCJaOTcaS38L9bM+CnWsPG6fepnRoKiZKekX5Mwpm8 jC4er69+TpdlezX5m7qcux2D+7wnmdmqeLflFHKdTBd5azCcmDcmJmJquH+5myL3r9DQ 2/Xck+5sLJvXwcZJLMttMiW+cgTEgufpI9wXA8MzEg33lMthN6QS01mldWLDMa0FmPH6 mi7m/mqWxEQ0RxZwmgarmi4nQOKm+65iUmYJEDflYnFGl+ptWGWXmPR5/3Se3lSo1GLU SJBi5pgy48vLInEK9ATOnJK+JyHnJZEYPHVXDhDoIqtzUVefNQeqCu9j/DB14BxJcw41 PUlg== X-Received: by 10.50.4.105 with SMTP id j9mr2922710igj.52.1385134692074; Fri, 22 Nov 2013 07:38:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.89.103 with HTTP; Fri, 22 Nov 2013 07:37:51 -0800 (PST) In-Reply-To: <1385134096491-5743696.post@n5.nabble.com> References: <1385134096491-5743696.post@n5.nabble.com> From: Claus Ibsen Date: Fri, 22 Nov 2013 16:37:51 +0100 Message-ID: Subject: Re: re-use route definition To: "users@camel.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Yes if you use Java RouteBuilder class you can use OO inheritance etc. Just create a abstract base class and add the shared logic in the configure method. And then extend this base class, and call super.configure() first. On Fri, Nov 22, 2013 at 4:28 PM, Olaf wrote: > Hello, > > what is the best way to reuse a route with different parameters? Let's say I > have many classes implementing RouteBuilder interface and add them all in > camel-context.xml > > > > > ... > .... > > > Almost in every Route class I repeat the similar logic: from("file:" + > in).process(new DoWork()).to("file:" + out); > > Is it possible to reuse this part in each Route, to avoid code duplication? > I'd have to configure in and out parameter in xml and import this part into > configure method of Route1,2 class. Are there any examples how to do it? > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/re-use-route-definition-tp5743696.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cibsen@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen