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 C205A10ADB for ; Mon, 27 Jan 2014 07:47:40 +0000 (UTC) Received: (qmail 51064 invoked by uid 500); 27 Jan 2014 07:47:39 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 50382 invoked by uid 500); 27 Jan 2014 07:47: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 50368 invoked by uid 99); 27 Jan 2014 07:47:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jan 2014 07:47:37 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.177 as permitted sender) Received: from [209.85.223.177] (HELO mail-ie0-f177.google.com) (209.85.223.177) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jan 2014 07:47:32 +0000 Received: by mail-ie0-f177.google.com with SMTP id at1so5405644iec.22 for ; Sun, 26 Jan 2014 23:47:11 -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=HOaaZ88hYuRjOldcJ8jYEN87LMb43f52DXrL3eJ6n6Q=; b=LEl0m+GSIM4ccnMIkfGF3PsZUVK7sgBV/FS6Pm+6IQYMhYmuU7GRtMOAQNPzb2lrny +GbW8p+uIRRiyeN6QzO0RHMUWN7lxKd7mEJMke/ZhU3r8qk2qx5AcEkLalyyhijR/sFu xBlE159fyMhzxz96zS4bWC8eVNtShV4eVc7d/PAmBB4H23YV5YOJEsyzHgKgGgK6BnNI Ue4/i9q9uX0TW3o7LD/ImN70Ef1cBfrOJxsA/n4kL6InQZDmLe2izEa2yUOboiMDKZ7z o6mSVfOecVNpye97o+gddWAwgFQItudhXIwo86YzHO/ZbProBfwcov+354787NQjwLg9 08sA== X-Received: by 10.50.66.144 with SMTP id f16mr16234372igt.48.1390808831771; Sun, 26 Jan 2014 23:47:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.133.72 with HTTP; Sun, 26 Jan 2014 23:46:51 -0800 (PST) In-Reply-To: References: From: Claus Ibsen Date: Mon, 27 Jan 2014 08:46:51 +0100 Message-ID: Subject: Re: cannot exchange mesasge body during a retryWhile() To: "users@camel.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi retryWhile is only for returning true|false, not for modifying. You should use onRedelivery to do any custom modifications before a redelivery attempt. On Sun, Jan 26, 2014 at 7:40 PM, Elvio Caruana (ecaruana) wrote: > Hi all, > > I've got a scenario where given an exception on a route, I want to retry the sub-route but with a modified body (String.class type). > from("direct:foo") > .onException(SomeException.class) > .handled(true) > .retryWhile(new Predicate() { > @Override > public boolean matches(Exchange exchange) { > if (canContinue()) { > exchange.getIn().setBody("newly modified string"); > return true; > } > else { > return false; > } > > } > }).end() > .to("direct:bar"); > > The retries are being done correctly and exhausted at the right time - however every retry always has the original body, and not the modified string body I was expecting. Am I not able to modify the exchange body on retry? > > Many Thanks, > Elvio > -- 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 Make your Camel applications look hawt, try: http://hawt.io