Why tnreceive doesnbt read full length of the FTP stream

Hello WMUsers,
I have developed a flow service, which takes ffdata (stream) as input and it has the following two steps

Step1: calls tn.doc:recognize with ffdata & hardcoded TN_parms such as SenderID,ReceiverID,DocTypeName,DocumentID
step2:invokes tn.doc:routeBizdoc with the bizdoc created by recognize in the above step

Test Result:

Now,I FTP’ed a .txt file with the size of 267,390 bytes. Upload was successful but when I looked at TN Transaction Analysis, I could see the file size as 8,646 bytes.

Result for Different Test Cases:

I have repeated this test to multiple times and I am consistently getting the same result. When I slightly change the file size I am getting same problem but instead of 8,646 bytes ,there is some other size is constantly appears.

Inefficient Workaround:

If I convert ffdata(stream) to bytes and then convert the bytes back to stream, it works fine.

This sounds to me that there might be buffered stream involved and TN takes first buffer and ignores the rest.

The problem with this workaround is, this flow service will put the whole content as the bytes in the pipeline and it will consume lot of server’s memory unlike having stream in the pipeline.

I would greatly appreciate if anybody could help me to fix this.

Thank you,