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 3BD947F4B for ; Thu, 14 Jul 2011 17:53:57 +0000 (UTC) Received: (qmail 26366 invoked by uid 500); 14 Jul 2011 17:53:56 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 26348 invoked by uid 500); 14 Jul 2011 17:53:56 -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 26340 invoked by uid 99); 14 Jul 2011 17:53:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 17:53:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dwhytock@gmail.com designates 209.85.210.41 as permitted sender) Received: from [209.85.210.41] (HELO mail-pz0-f41.google.com) (209.85.210.41) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 17:53:48 +0000 Received: by pzk4 with SMTP id 4so818966pzk.14 for ; Thu, 14 Jul 2011 10:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=b6ksvyll0miMLQkhZnkfrrftQOQNCLMybKrKLVXDrBI=; b=N1mSnyWJYWJByfmYm5Iwkw8qw5Ez6Gq2qK/UkFvA1hRhUneisd/AU9BdMGWsFHKH15 RbzMZoMp6RSw99QjgRt7/8Eso/6xnl2gpcY40C7C71zOXolVlkNAnrdLFTverMm6fEjh krX+G4AA9tVUm7lQUo/JKn5VUpAYICSkipguE= MIME-Version: 1.0 Received: by 10.68.42.40 with SMTP id k8mr185331pbl.65.1310666006802; Thu, 14 Jul 2011 10:53:26 -0700 (PDT) Received: by 10.68.51.194 with HTTP; Thu, 14 Jul 2011 10:53:26 -0700 (PDT) In-Reply-To: References: Date: Thu, 14 Jul 2011 13:53:26 -0400 Message-ID: Subject: Re: Adding properties to an Exchange From: Donald Whytock To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Sorry...make that http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/m= odel/ProcessorDefinition.html#setProperty(java.lang.String, org.apache.camel.Expression) On Thu, Jul 14, 2011 at 1:51 PM, Donald Whytock wrote: > Actually, you don't need the Processor, if it's a relatively static > value. =A0You can use > > =A0from().setProperty().to() > > http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel= /model/ProcessorDefinition.html#setProperty(java.lang.String) > > Don > > On Thu, Jul 14, 2011 at 1:41 PM, Jeff Segal wro= te: >> I'd like to know the best way to add domain-specific context information= to >> Exchanges linked to a particular RouteBuilder. Let's say that I have the >> following: >> >> public class MyRouteBuilder extends RouteBuilder { >> >> =A0 =A0String someProperty; >> >> =A0 =A0@Override >> =A0 =A0public void configure() throws Exception { >> =A0 =A0 =A0 =A0from("direct:foo").to("bean:myBean"); >> =A0 =A0} >> >> } >> >> public class MyBean { >> =A0public void handle(Exchange exchange) { >> // Want to access 'someProperty' of MyRouteBuilder here >> } >> } >> >> One way that I believe would work here would be to add a Processor to th= e >> Route which called exchange.setProperty(), then access it in MyBean via >> exchange.getProperty(). However, I'm curious if there is an easier/more >> preferred way of doing this. >> >> Thanks, >> Jeff >> >