Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 85628 invoked from network); 23 Jun 2008 08:26:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jun 2008 08:26:15 -0000 Received: (qmail 55409 invoked by uid 500); 23 Jun 2008 08:26:16 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 55387 invoked by uid 500); 23 Jun 2008 08:26:16 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 55376 invoked by uid 99); 23 Jun 2008 08:26:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jun 2008 01:26:16 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.69.129.178] (HELO exsmtp02.exserver.dk) (195.69.129.178) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jun 2008 08:25:24 +0000 Received: from EXVS04.exserver.dk ([10.10.10.85]) by exsmtp02.exserver.dk with Microsoft SMTPSVC(6.0.3790.1830); Mon, 23 Jun 2008 10:23:38 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: from http://... to file://... Date: Mon, 23 Jun 2008 10:24:24 +0200 Message-ID: <4C1FB9C00D24A140906239533638C4D2049DD4F8@EXVS04.exserver.dk> In-Reply-To: <44906.192.168.1.35.1214208285.webmail@192.168.1.35> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: from http://... to file://... Thread-Index: AcjVB9G9BjjqYVinS4GTfxZvlXpNHwAAnerQ From: "Claus Ibsen" To: , X-OriginalArrivalTime: 23 Jun 2008 08:23:38.0924 (UTC) FILETIME=[70391EC0:01C8D50A] X-Virus-Checked: Checked by ClamAV on apache.org Hi Patrick Argh I do think that it's only exposed on the Exchange interface in 1.4. In Camel 1.3 you can cast the Exchange to DefaultExchange and use the = setPattern method. BTW: I will try to investigate why the FileProducer is doing the polling = when it's an InOut exchange - I can not see the reason for it. Med venlig hilsen =20 Claus Ibsen ...................................... Silverbullet Skovsg=E5rdsv=E6nget 21 8362 H=F8rning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: Patrick Shea [mailto:patrick@ps1.net]=20 Sent: 23. juni 2008 10:05 To: camel-user@activemq.apache.org Subject: RE: from http://... to file://... Claus, I don't see a setPattern(...) on the Exchange class in 1.3? Patrick -----Original Message----- From: "Claus Ibsen" Sent: Monday, June 23, 2008 1:08am To: camel-user@activemq.apache.org Subject: RE: from http://... to file://... Hi Joe By all means please post any questions you have to this user forum.=20 Ad 1) Yes your observations is correct. If the file component gets an out = capable exchange then its trying to poll the file. So you need to change = the mep pattern to inonly. The HTTP protocol is by nature request-response based so that is why = Camel will send back a response if you use camel-jetty. You should = probably send back a response with HTTP STATUS 200 to indicate to the = client that you have accepted/consume his request. Ad 2) Send a response back to the client. Ad 3) You can use a processor to change/handle the exchange programmatically. from("xxx").process(new MyProcessor()).to("yyy") Here is some help for your route to do what you want: protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { = from("jetty:http://localhost:8080/myworld").to("seda:in").setBody(constan= t("We got your request")); from("seda:in").process(new MyJettyProcessor()). setHeader(FileComponent.HEADER_FILE_NAME, = "hello.txt").to("file://target/myworld"); } }; } private class MyJettyProcessor implements Processor { public void process(Exchange exchange) throws Exception { // must convert to in only as file producer will try to load = the file if the exchange pattner // is out capable. exchange.setPattern(ExchangePattern.InOnly); } } Med venlig hilsen =20 Claus Ibsen ...................................... Silverbullet Skovsg=E5rdsv=E6nget 21 8362 H=F8rning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: Joe Satch [mailto:upadhyay.k@gmail.com]=20 Sent: 22. juni 2008 22:18 To: camel-user@activemq.apache.org Subject: RE: from http://... to file://... Hi, I am quite new to camel, so plz excuse me if i say something = fundamentally wrong.=20 What i am not able to understand here is that if I wish to open an http serversocket to listen to requests and persist them to a file, how do i = go for it. I could open a serversocket using jetty component, and then I = routed the incoming messages to a file URI. It threw me exception. My analysis of the problem was that the jetty server component makes an Inout exchange and forwards the content to file URI and waits for the response to come as it instantiated an Inout MEP. And it never gets the response back as the file component probably expects an Inonly MEP or something of that sort.=20 My questions 1. Is my analysis wrong. 2. If I wish to do what i am trying to, how do I go abt it ? 3. How do I trap an exchange programtically and then do something with = it ? thanks >Ah the issue is that the Jetty component is an EventDrivenConsumer and = not Scheduled. So you have to >trigger the event yourself to start the event = in jetty. >Eg: >from("timer://foo?fixedRate=3Dtrue&delay=3D0&period=3D10000").to("jetty:= http://www.google.com").setHeader>(FileComponent.HEADER_FILE_NAME, "message.txt").to("file:target/hello"); >This will invoke the google homepage every 10th second and store it as = a file. >http://activemq.apache.org/camel/event-driven-consumer.html --=20 View this message in context: = http://www.nabble.com/from-http%3A--...-to-file%3A--...-tp17739149s22882p= 18058624.html Sent from the Camel - Users mailing list archive at Nabble.com.