Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 30370 invoked from network); 15 Dec 2009 17:53:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Dec 2009 17:53:21 -0000 Received: (qmail 62342 invoked by uid 500); 15 Dec 2009 17:53:21 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 62311 invoked by uid 500); 15 Dec 2009 17:53:21 -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 62301 invoked by uid 99); 15 Dec 2009 17:53:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Dec 2009 17:53:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of janstey@gmail.com designates 209.85.219.227 as permitted sender) Received: from [209.85.219.227] (HELO mail-ew0-f227.google.com) (209.85.219.227) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Dec 2009 17:53:11 +0000 Received: by ewy27 with SMTP id 27so129893ewy.36 for ; Tue, 15 Dec 2009 09:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=XeOXsW9cWUkIbLBysWmbOlQ83Lf0b4GY5jAzOJ1ND3I=; b=Qlgg6e282nIgahUXSqtZBdPAeFoCXfc9D4LbZX1/Ov96E7D03vhB0e70JnhiP+Nhs7 nIjIsDnRb9NBkacvL5HZQ0/R1g+8FMZ+TtEJXxHSfS+TP6HxUvdTpjWWZOxd5oZdcCvm eE+AnziY0kIIvm3XWS78xiZuHZKaJUoPVsZrM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=u5D+wP+sl0jzzbh+iG6V4L4fAeAoy2K7+vpa2rOPiSsAa7uT1zYsLSmL8MzbKHCaXh elfR7coLnZOia0fKntthwL8YIOVG3BtrdR7IvMzf52SssAMMof8O2kn7u/Vq4fJ9AtJK T4nXrTn7qdlZORnsL3s0PJrCTa8tL0F6bh3XQ= MIME-Version: 1.0 Received: by 10.213.25.74 with SMTP id y10mr406706ebb.14.1260899570709; Tue, 15 Dec 2009 09:52:50 -0800 (PST) In-Reply-To: <26798115.post@talk.nabble.com> References: <26779963.post@talk.nabble.com> <2748945d0912141132k6ff61603l10ef36957bf866c1@mail.gmail.com> <26794573.post@talk.nabble.com> <2748945d0912150540y60f557c2v5a848df6c5c96bb0@mail.gmail.com> <26795823.post@talk.nabble.com> <2748945d0912150715j35bfefcdpba5f52f66dbc13a8@mail.gmail.com> <26798115.post@talk.nabble.com> Date: Tue, 15 Dec 2009 14:22:50 -0330 Message-ID: <2748945d0912150952r7b4f0446jdb422b697ee45fdd@mail.gmail.com> Subject: Re: Help to understand xpath expression in camel routebuilder From: Jon Anstey To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0015174413660276a8047ac80feb X-Virus-Checked: Checked by ClamAV on apache.org --0015174413660276a8047ac80feb Content-Type: text/plain; charset=ISO-8859-1 On Tue, Dec 15, 2009 at 1:33 PM, Kenneth H wrote: > > > On Tue, Dec 15, 2009 at 11:26 AM, Kenneth H wrote: > > > > > 1. Where can I read about the ".namespace()" function syntax? I still > > don't > > > get why "ins" is used in both functions. I tried w3schools but didn't > > find > > > it. > > > > >Did you find this page? > > >http://www.w3schools.com/XML/xml_namespaces.asp > > > > > >That should help you understand usage of the namespace prefix and URI.> > > > > > > > I know namespaces in general, bit it was the syntax of the ".namespace()" > > function in xpath, I was looking for. > > > > >Ah Cool stuff. The public javadoc may be helpful to you then > > >http://camel.apache.org/maven/camel- > >core/apidocs/org/apache/camel/builder/xml/XPathBuilder.html#namespace(java.lang.String,%>20java.lang.String) > > Perfect. Actually I was looking here earlier, but I must have missed it. > > > > > 2. Is it possible to debug in the Camel routebuilder somehow? If I want > > to > > > know how the message looks like before and after the > > > ".convertBodyTo(DOMSource.class)". And most important: I want to know > if > > > an > > > expression evaluates to true, i.e. I want to "print-out" the result of > > the > > > when statement. Maybe something like this pseudocode: > > > > > > var travelRequest = xpath("//ins:TravelInsuranceRequest").namespace > > > "ins","http://dzone.com/insurance")) > > > > > > print(travelRequest); > > > > > > .when(travelRequest).to(LUXURY_CAR_OUT); > > > > > > > >I guess it depends on how you have this deployed... if its a JUnit test, > > >well Eclipse or IntelliJ can easily debug that for you. Other setups may > > >require extra configuration of the app server / ESB to get debugging > > >working. Actually, if you just want to see what the messages look like > at > > >various points in your route, try enabling the tracer > > >http://camel.apache.org/tracer.html > > > > > > I will look into the tracer - didn't know of that. I have just created a > > Maven project and deployed it on the Servicemix ESB. Hard to find out how > > to > > debug :) > > > > >If you are using the latest ServiceMix, you can follow some notes here to > >turn on debugging > > > https://repository.apache.org/content/groups/public/org/apache/felix/karaf/manual/1.3.0- > >SNAPSHOT/manual-1.3.0-SNAPSHOT.html#KarafUsers%27Guideinonepage-5.1.Troubleshooting%>2CDebuggingandProfiling > > This might be very helpful to me! > > > > > One last novice question. In the statement: > > > > from("seda:a").filter(header("foo").isEqualTo("bar")).to("seda:b"); > > > > Where does the "foo" comes from, I mean, where do I set it? From Eclipse > > I'm > > creating a JMS Message, but the only headers availbe is these: > > > > > > > http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=/com.ibm.IBMDI.doc/referenceguide95.htm > > > > Do you know how I can use these headers/properties in a Camel choice > > statement? Basicly, I just want to create the most simple example, where > > to > > messages are send from Eclipse and goes to two different queues in a > Camel > > choice statement. The messages should be simple tect or objects. > > > > >You should be able to access any of the JMS headers you mentioned in the > >same way the "foo" header is referenced. So how are you sending JMS > messages > >from Eclipse? I'm assuming its a function of Tivoli in the link you > >provided? > > I (or the writer of the document I'm reading) made af "Response" class > called "InsuranceResponse". The response class is sent to the Camel > Routebuilder. I would like to swith on either the classname of the object > I'm sending or a field, e.g. "CompanyName", in the object. I create/send > like this: > > ObjectMessage insuranceMessage = session.createObjectMessage(); > InsuranceResponse response = new InsuranceResponse(); > response.setRequestID("1"); > response.setInsuranceCompanyName("Luxury Cars"); > response.setPrice(100f); > response.setResponseID(UUID.randomUUID().toString()); > insuranceMessage.setObject(response); > producer.send(insuranceMessage); > > Then I receive like this ("responseMessage" returns null all the time, but > I > guess it's beacuse my Camel Routebuilder isn't wotking, so no object is > send > to the queue): > > ObjectMessage responseMessage = (ObjectMessage) consumer.receive(); > InsuranceResponse insuranceMessageReceived = (InsuranceResponse) > responseMessage.getObject(); > > > >>You can also use Camel to set a header like so > > >>from("seda:a").setHeader("foo", constant("bar"))... > > Cool. But what is the corresponding function in Eclipse/JMS to the > "setHeader"?! > You are using the raw JMS API so you can set a property on the ObjectMessage before sending. See: http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html > > > Kind regards > Kenneth H > > > -- > View this message in context: > http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26798115.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Cheers, Jon Camel in Action: http://manning.com/ibsen Blog: http://janstey.blogspot.com --0015174413660276a8047ac80feb--