hello,
you can use a circular buffer witch is deep enough to contains the maximum length of a message.
If you have a gap : silence time beetween each message ,you can use a timeout as an event , to decide
extract the message from the buffer and reinitialise the pointer at the beginning of buffer.
If you have a repetitive or recurent special caratere in your message , like a # or & or <CR> or <LF>
you can decide to extract the message from buffer ,when this special caractere occurs..