Hi Mina have some delimiters that can be configued to UNIX or what else format. By default it runs in some auto format where it tries to guess it. http://mina.apache.org/report/1.1/apidocs/org/apache/mina/filter/codec/textline/LineDelimiter.html
You could try plain mina and assemble the encoder/decode yourself to use the right line delimiter. Browsing the javadoc it doesn't look like it's easy to set a new line delimiter. But I guess we should support this in Camel as a URI option. I will create a ticket for this. But try with plain mina to see if you can get it working. We can use this work as a help for adding this feature directly into camel. /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/ On Wed, Dec 3, 2008 at 11:06 AM, Suraf <[EMAIL PROTECTED]> wrote: > > TCP server returns an answer in less than 1 second, so it might not be > related to timeout. > > What else protocol can I use to be sure that Mina will correctly handle XML > response from server? > Is there anything like "xmlline" that I can use to let Mina know how to > indicate an end of message? > > > Best regards, > Suraf > > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Ah that could be it the TCP server newer returns a response and >> camel-mina with timeout after 30 seconds. >> And then it continues the routing, so you kinda get the input concatted. >> >> In this situation camel-mina doesn't properly report that there is an >> issue, that the remote server didn't return a response. >> It should throw an IOException indicating this error. >> >> I will create a ticket in JIRA for this. >> >> Since you are using textline as the protocol the remote TCP server >> must send some kind of \n to indicate end of data. >> >> >> >> >> >> /Claus Ibsen >> Apache Camel Committer >> Blog: http://davsclaus.blogspot.com/ >> >> >> >> On Wed, Dec 3, 2008 at 9:56 AM, Suraf wrote: >>> >>> TCP server returns plain XML message and it is working for sure (if I'm >>> using >>> some other TCP component it is working fine and gets message from >>> server). >>> >>> Probably the problem is in connection definition. I found sth like that >>> in >>> log: >>> >>> DEBUG - MinaProducer - Waiting for response >>> DEBUG - MinaProducer - Session closed but no message received from >>> address: >>> /123.123.123.123:12345 >>> >>> >>> Best regards, >>> Suraf >>> >>> >>> >>> Claus Ibsen-2 wrote: >>>> >>>> On Wed, Dec 3, 2008 at 9:37 AM, Suraf wrote: >>>>> >>>>> Hi, >>>>> >>>>> #1: TCP server expects plain XML so I removed transferExchange=true >>>>> option. >>>>> Thanks for that. >>>>> >>>>> >>>>> #2: My In message from 2nd processor looks like a sum of In message >>>>> from >>>>> 1st >>>>> processor and Out message (which is a processed In message) from 1st >>>>> processor. So it looks like in below example: >>>>> >>>>> Processor I - In message: <AAA><BBB/></AAA> >>>>> Processor I - Out message (after processing In message): >>>>> <AAA><BBB><CCC/></BBB></AAA> >>>>> Processor II - In message: >>>>> <AAA><BBB/></AAA><AAA><BBB><CCC/></BBB></AAA> >>>>> Processor II - Out message: null >>>>> >>>>> Maybe I'm wrong but it doesn't seem that Out from TCP is In for 2nd >>>>> processor... >>>> What is the OUT from the TCP? Maybe you can invoke the TCP directly >>>> and see what it actually returns. >>>> >>>> You could also try with a mock of the TCP server to return a fixed >>>> response so you know what the OUT is and thus better can find out what >>>> is wrong. >>>> >>>> >>>> >>>>> >>>>> >>>>> >>>>> I turned on tracing but it doesn't say anything more than >>>>> java.lang.NullPointerException :( >>>> Ah that could be the bug in Camel if a body is null. You need to turn >>>> showBodyType=false to avoid this NPE: >>>> http://activemq.apache.org/camel/tracer.html >>>> >>>> >>>> >>>>> >>>>> Any suggestions on that, please? >>>>> >>>>> >>>>> Best regards, >>>>> Suraf >>>>> >>>>> >>>>> >>>>> >>>>> Claus Ibsen-2 wrote: >>>>>> >>>>>> Hi >>>>>> >>>>>> #1 >>>>>> What format does the TCP server expect? >>>>>> If it should be the exchange body as plain XML then you should not use >>>>>> transferExchange=true. >>>>>> >>>>>> >>>>>> #2 >>>>>> In the last processor could you try getting the IN body instead. >>>>>> The processor is part of a new route where the OUT from the TCP server >>>>>> is used as IN in the next node. >>>>>> >>>>>> BTW: You can use the tracer to see the messages being passed in the >>>>>> log >>>>>> http://activemq.apache.org/camel/tracer.html >>>>>> >>>>>> >>>>>> /Claus Ibsen >>>>>> Apache Camel Committer >>>>>> Blog: http://davsclaus.blogspot.com/ >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Dec 2, 2008 at 5:35 PM, Suraf wrote: >>>>>>> >>>>>>> All, >>>>>>> >>>>>>> I'm trying to execute a few steps using Camel-Mina TCP component in >>>>>>> servicemix: >>>>>>> - get InOut message from ServiceMix component >>>>>>> - process message (processed message is still an XML) >>>>>>> - send it to TCP server (via Mina) >>>>>>> - get response from TCP server (response is an XML) >>>>>>> - process response and send it back to ServiceMix component >>>>>>> >>>>>>> Here is my code: >>>>>>> >>>>>>> public class TcpRouteBuilder extends RouteBuilder { >>>>>>> >>>>>>> public void configure() throws Exception { >>>>>>> >>>>>>> String fullAddress = new StringBuilder() >>>>>>> .append("mina:tcp://") >>>>>>> .append(serverAddress) >>>>>>> .append(":") >>>>>>> .append(serverPort) >>>>>>> >>>>>>> .append("?textline=true&sync=true&transferExchange=true").toString(); >>>>>>> >>>>>>> >>>>>>> from("jbi:endpoint:http://namespace/tcpService/tcpEndpoint").process( >>>>>>> new Processor() { >>>>>>> public void process(Exchange exchange) throws >>>>>>> Exception >>>>>>> { >>>>>>> String xmlString = convertToString((DOMSource) >>>>>>> exchange.getIn().getBody()); >>>>>>> xmlString = prepareMessage(xmlString); >>>>>>> exchange.getIn().setBody(xmlString); >>>>>>> } >>>>>>> } >>>>>>> ).to(fullAddress).process( >>>>>>> new Processor() { >>>>>>> public void process(Exchange exchange) throws >>>>>>> Exception >>>>>>> { >>>>>>> // here some additional processing of response >>>>>>> is >>>>>>> required but body seems to be null >>>>>>> Object body = exchange.getOut().getBody(); >>>>>>> body = processBody( body ); >>>>>>> exchange.getOut().setBody(body); >>>>>>> } >>>>>>> } >>>>>>> ); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> In the second processor I get null from exchange.getOut().getBody(). >>>>>>> >>>>>>> What am I doing wrong? How should I get valid XML response from TCP >>>>>>> and >>>>>>> process it somehow? >>>>>>> Could you please advice something? >>>>>>> >>>>>>> I'm using FuseESB 3.3.1.11 with Camel 1.5.0 >>>>>>> (camel-core-1.5.0.0-fuse.jar >>>>>>> and >>>>>>> camel-mina-1.5.0.jar) and Mina 1.1.7 (mina-core-1.1.7.jar). >>>>>>> >>>>>>> Thanks in advance for your help. >>>>>>> >>>>>>> -- >>>>>>> View this message in context: >>>>>>> http://www.nabble.com/camel-mina-in-servicemix---how-to-process-TCP-response--tp20794416s22882p20794416.html >>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/camel-mina-in-servicemix---how-to-process-TCP-response--tp20794416s22882p20808827.html >>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/camel-mina-in-servicemix---how-to-process-TCP-response--tp20794416s22882p20809061.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> > > -- > View this message in context: > http://www.nabble.com/camel-mina-in-servicemix---how-to-process-TCP-response--tp20794416s22882p20810015.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
