Hi If you want to return a response immediately from the webservice, you can break up the route into 2 pieces.
For example you can use the wire tap EIP pattern http://camel.apache.org/wire-tap.html from(cxf) wireTap(direct:b) transform(constant("some reply")); from(direct:b) multicast On Wed, Jan 13, 2010 at 9:35 AM, ztesoft <njche...@hotmail.com> wrote: > > I find soapUI waited for the http reply after it sent the request until the > program ended. The solution is let the camel reply. > Just add the code "e.getOut().setBody("I received HTTP request");" into the > process block. Then soapUI can get the reply after it sends the request. > > Do I walk a right way to solve the problem? > > > > Claus Ibsen-2 wrote: >> >> On Wed, Jan 13, 2010 at 8:07 AM, ztesoft <njche...@hotmail.com> wrote: >>> >>> This method "seems" like solve the problem. >>> But, I find soapUI waited for the http reply after it sent the request >>> until >>> the program ended. >>> Maybe this is another topic about how to handle the request and reply. >>> Does >>> anyone know it? >>> Also I want to ask how can I save many requests into one file not one >>> request into one file. >>> >> >> You should append to the file and specify a filename to use. >> http://camel.apache.org/file2.html >> >> For example adding these options to the URI >> fileExist=Append&fileName=foo.txt >> >> The fileName can also be specified from Java by setting the >> Exchange.FILE_NAME header. >> >> >> >> >> >> >>> >>> >>> >>> willem.jiang wrote: >>>> >>>> It's a stream caching issue, Camel 2.x disable it by default for better >>>> performance. >>>> You can more information here[1] >>>> >>>> [1] http://camel.apache.org/stream-caching.html >>>> >>>> Willem >>>> >>>> ext2 wrote: >>>>>>> Use .convertBodyTo(String.class) after the from. This will store the >>>>>>> HTTP >>>>> data >>>>>>> as a String which can be safely duplicated when you do a multicast. >>>>> Is the problem is really caused by duplicating message? >>>>> >>>>> If it does, does the multi-cast support a strategy for end-user who can >>>>> control how to duplicate the data saved in message? >>>>> >>>>> >>>>> -----Original----- >>>>> Sender: Claus Ibsen [mailto:claus.ib...@gmail.com] >>>>> Date: 2010-1-11 14:18 >>>>> Receiver: users@camel.apache.org >>>>> Subject: Re: Question about multicasting. >>>>> >>>>> On Mon, Jan 11, 2010 at 7:00 AM, ztesoft <njche...@hotmail.com> wrote: >>>>>> Dears, I try to use multicast to save the received message into two >>>>>> files >>>>>> using >>>>>> >>>>> "from("jetty:http://0.0.0.0:8080/").multicast().to("file://output","file://o >>>>> utput1");" >>>>>> It works correctly. Two files will be saved in /output/.camel/ and >>>>>> /output1/.camel/ folders separately. >>>>>> >>>>>> But if I use activemq for a endpoint, there may be something wrong. >>>>>> 1st. I use activemy queue instead of the second endpoint. >>>>>> >>>>>> >>>>> from("jetty:http://0.0.0.0:8080/").multicast().to("file://output","test-jms: >>>>> queue:test.queue"); >>>>>> from("test-jms:queue:test.queue").process(new Processor() { >>>>>> public void process(Exchange e) throws IOException >>>>>> { >>>>>> System.out.println("Received exchange: " + >>>>>> e.getIn()); >>>>>> >>>>>> System.out.println(e.getIn().getBody(String.class)); >>>>>> } >>>>>> }); >>>>>> } >>>>>> }); >>>>>> In this case, when I send a HTTP request, the result is one file saved >>>>>> in >>>>>> /output/ folder and a message displayed in console. The content of >>>>>> this >>>>>> message is: >>>>>> "Received exchange: JmsMessage: ActiveMQBytesMessage {commandId = 5, >>>>>> responseRequired = true, messageId = >>>>> ID:chenyi-4710-1263188603156-2:2:1:1:1, >>>>>> originalDestination = null, originalTransactionId = null, producerId = >>>>>> ID:chenyi-4710-1263188603156-2:2:1:1, destination = >>>>>> queue://test.queue, >>>>>> transactionId = null, expiration = 1263188625859, timestamp = >>>>> 1263188605859, >>>>>> arrival = 0, brokerInTime = 1263188605859, brokerOutTime = >>>>>> 1263188605859, >>>>>> correlationId = 5a1b6157-a4cb-4f8a-aa78-82519a776bf0, replyTo = >>>>>> temp-queue://ID:chenyi-4710-1263188603156-2:1:1, persistent = true, >>>>>> type >>>>>> = >>>>>> null, priority = 4, groupID = null, groupSequence = 0, >>>>>> targetConsumerId >>>>>> = >>>>>> null, compressed = false, userID = null, content = >>>>>> org.apache.activemq.util.byteseque...@6a63d3, marshalledProperties = >>>>>> null, >>>>>> dataStructure = null, redeliveryCounter = 0, size = 1024, properties = >>>>>> {CamelHttpUrl=http://127.0.0.1:8080/, >>>>>> Content_HYPHEN_Type=text/xml;charset=UTF-8, Host=127.0.0.1:8080, >>>>>> CamelHttpMethod=POST, Content_HYPHEN_Length=681, >>>>>> SOAPAction="http://www.ctcc.com/service/sendSms", >>>>>> CamelHttpCharacterEncoding=UTF-8, User_HYPHEN_Agent=Jakarta >>>>>> Commons-HttpClient/3.0.1, CamelHttpPath=/, CamelHttpUri=/}, >>>>>> readOnlyProperties = true, readOnlyBody = true, droppable = false} >>>>>> ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = >>>>>> java.io.datainputstr...@bfed5a }" >>>>>> >>>>>> 2nd. >>>>>> I change the order for the multicast endpoint. >>>>>> >>>>>> >>>>> from("jetty:http://0.0.0.0:8080/").multicast().to("test-jms:queue:test.queue >>>>> ","file://output"); >>>>>> from("test-jms:queue:test.queue").process(new Processor() { >>>>>> public void process(Exchange e) throws IOException >>>>>> { >>>>>> System.out.println("Received exchange: " + >>>>>> e.getIn()); >>>>>> >>>>>> System.out.println(e.getIn().getBody(String.class)); >>>>>> } >>>>>> }); >>>>>> } >>>>>> }); >>>>>> In this case, when I send a HTTP request, the message displayed >>>>>> correctly >>>>> in >>>>>> th console(the http request body displayed). But there is not any file >>>>> saved >>>>>> in any folder. >>>>>> >>>>>> Does anyone know the reasons and how to solve this problem? >>>>>> -- >>>>> >>>>> Use .convertBodyTo(String.class) after the from. This will store the >>>>> HTTP data as a String which can be safely duplicated when you do a >>>>> multicast. >>>>> >>>>> >>>>> >>>>>> View this message in context: >>>>> http://old.nabble.com/Question-about-multicasting.-tp27106219p27106219.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Question-about-multicasting.-tp27106219p27140410.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/Question-about-multicasting.-tp27106219p27141244.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus