Request streaming handling

Not applicable

We have a requirement to upload the file to SFTP. We have a Java Callout for that. But for files greater than 10 MB we need to enable request streaming. Can you please let us know if we can upload the incoming stream file data to SFTP using Java callouts ?

1 1 456
1 REPLY 1

Yes, you should be able to do it.

You need to turn on streaming in the proxy endpoint. I guess you have already seen the documentation on that.

At that point you can use a JavaCallout to read from the stream. The important bit is to use

messageContext.getRequestMessage().getContentAsStream()  

This is a readable stream.

You can then design your Java callout to read from the stream and write to the open stream on the SFTP connection.

You said you already have the Java Callout. If that's the case, check that it behaves this way.

If you are using this callout, then it does the right thing with the stream.

You can view the relevant code here.

To get it to read the message content as stream you must not use the source-variable property in the Java policy. (It's not documented, so you probably are not using it) .