I think the problem is the textline codec. If you implement your own custom
mina codec that might give you more control over the incoming stream. You
could then return a stream of java pojo on to the next step in the route.

Hope this helps
/Dave

On Thu, May 7, 2009 at 12:16 PM, will mad <[email protected]> wrote:

> Thanks Ryan,It works perfectly when splitting instruction is following a
> from("mina:tcp://localhost:4122?textline=true"), but not in my case where
> the splitting instruction follows a
> to("mina:tcp://localhost:4122?textline=true"). Only the first line of the
> response is processed. My component acts as a client so I have to send a
> request first and wait for the response.
>
>
>
> On Wed, May 6, 2009 at 6:39 PM, Ryan Gardner <[email protected]> wrote:
>
> >
> > On May 6, 2009, at 9:50 AM, will mad wrote:
> >
> >  Hi,
> >>
> >> I would like to write a route inside camel in order to handle the
> >> following
> >> scenario:
> >>
> >> Send an http request to a distant system like this one : “GET
> >> /execute.cgi?opname=get_notifications HTTP/1.1”
> >>
> >> When receiving this HTTP request, the distant server responds, in a
> >> continuous-session HTTP reply. It means that the HTTP session remains
> >> alive
> >> and is never closed. The distant system continuously sends messages. So
> my
> >> camel component has to send the request and then continuously receives
> >> data
> >> from the distant server. My problem is when I send the request, I only
> >> receive the first line of the message from the distant system, and leave
> >> my
> >> route without processing other messages.
> >>
> >> Here is my route:
> >>
> >> from("file://c:/tmp/test?delete=true")
> >>
> >> .to("log:request")
> >>
> >>     .setBody(constant("GET /execute.cgi?opname=get_notifications
> >> HTTP/1.1\r\n\r\n"))
> >>
> >>     .to("mina:tcp://localhost:4122?textline=true&sync=false")
> >>
> >>     .to("log:response");
> >>
> >
> > http://camel.apache.org/splitter.html
> >
> > I saw this today while looking at the splitter for another use - but this
> > seems to apply to what you want:
> >
> > "Available as of Camel 1.5
> >
> > You can split streams by enabling the streaming mode using the streaming
> > builder method.
> >
> >
> >
> from("direct:streaming").split(body().tokenize(",")).streaming().to("activemq:my.parts");"
> > It would seem that in your case doing something like this:
> >
> >
> >
> .to("mina:tcp://localhost:4122?textline=true&sync=false").split(body().tokenize("\n")).streaming().to("log:response");
> >
> > should do the trick.
> >
> > Ryan
>

Reply via email to