On Wed, Oct 22, 2008 at 1:25 PM, Maarten Bosteels <[EMAIL PROTECTED]> wrote: > On Wed, Oct 22, 2008 at 6:42 AM, Ashish <[EMAIL PROTECTED]> wrote:
>> >> Just to make life a little more complicated, here are the things I got >> stuck >> >> 1. Large packets get fragment. I used MINA's pom.xml and tested it, >> got 4 read operations. Now the question is how should I detect and >> reassemble out of order packets? I my code I simply appended to the >> buffer for each read. MINA experts to guide on guide on this. > > > IMO reassembling out of order packets should not be done in this layer. > If you need your packets in order, use TCP: it does the reassembling for > you. That clears my doubt, Using NioSocketAcceptor, so the problem is solved. >> >> 2. To create a generic XML Decoder, we need to have functionality as >> per XML spec. for simple xml easy solution would do. My program failed >> coz, pom.xml had comment after <?xml version="1.0" encoding="UTF-8"?> >> <!-- --> :-( > > > While I think it would be great to have an example MINA app that deals with > decoding XML, > I don't think a generic XML Decoder should be part of MINA. > > I wonder if their are java XML libs out there (xmlbeans ?) that take an > InputStream parameter, so that one can feed bytes into it > and it will notify when a complete message is decoded. I thought about this option, but STAX parsers can do this job, but want to avoid this. Do you think its good idea just to accumulate the complete bytes and then subsequently parse and insert the object in ProtocolDecoderOutput or use separate Filters/Decoder for this. >> 3. If have 2 xml messages in my decoder, how to pass one to handler >> and keep other withing decoder till its get completed. Basically >> generating 2 message received at IoHandler? > > > This should automatically be taken care of when you subclass from > CumulativeProtocolDecoder. Just to complete my understanding, not sure how this can be achieved. Is it correct interpretation that the moment we write on ProtocolDecoderOutput, the next stage processing shall take place. say this is the scenario, 2 xml packets are sent by client, we receive 8 fragments and hence 8 read operations. In CumulativeProtocolDecoder, in doDecode(), we continue to find end element for the first XML msg. We find it and there are still some more bytes in the IoBuffer (signifying the start of second message). So if I write the first message to ProtocolDecoderOutput, and continue to return false till I get the complete second packet and so on. Is this understanding correct? >> We could overcome problem 2 using some regular expression and >> implementing basic XML parser functionality. Alternatively for a very >> robust implementation we may use implementation similar to AsyncWeb's >> DecodingState parsing of HTTP. >> >> I have been blogging about MINA for a while. Trustin and Mike have >> already been there. Not sure whether to share them here or not? The >> post are the simple example programs that I worked out using MINA. >> Forum admins can guide me on this. > > > Not sure what the question is ? > It certainly is OK to announce blog posts about MINA on this list. That was the question. Can we announce our post's here. Have a look http://www.ashishpaliwal.com/blog > Maarten > > > >> >> >> thanks >> ashish >> >> On Wed, Oct 22, 2008 at 4:03 AM, Andres Martinez Quijano >> <[EMAIL PROTECTED]> wrote: >> > so the <?xml version="1.0" encoding="UTF-8"?> tag uniquely describes >> > the begining of a new document >> > >> > On Tue, Oct 21, 2008 at 6:37 PM, newToMina <[EMAIL PROTECTED]> wrote: >> >> >> >> The messages will of the following format. >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <Message> >> >> <MessageType>XYZ</MessageType> >> >> <MessageId>1212</StoreNum> >> >> <DateTime>20070510132500</DateTime> >> >> . >> >> . >> >> . >> >> . >> >> </Message> >> >> >> >> The </Message> tag indicates the end of a document. >> > >> >> >> >> -- >> thanks >> ashish >> >> Blog: http://www.ashishpaliwal.com/blog >> >> My Photo Galleries: http://www.pbase.com/ashishpaliwal >> > -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
