Moleculer: File upload - to an action

Created on 16 Mar 2018  路  3Comments  路  Source: moleculerjs/moleculer

In case we upload a file from gateway API, I wonder how to stream the uploaded file to a remote service ?

Proposal

Most helpful comment

Depending on the transporter that you are using, it may or may not make sense to upload file via moleculer.

If you are, say, uploading a small json file, then it probably makes sense to do an RPC call.

However, if you are trying to upload, say, a use profile picture, then it probably makes more sense to:
1) do an RPC call to generate a pre-signed URL
2) upload the said file to S3/S3-compatible storage with the URL
3) do another RPC call with the URL, so the remote service can process.

This would avoid the slow consumer problem and reduce the bandwidth usage in the transporter channel (especially if you are using gnatsd then it has strict some requirements).

All 3 comments

For this, we need stream supporting on request side (in broker.call)

Depending on the transporter that you are using, it may or may not make sense to upload file via moleculer.

If you are, say, uploading a small json file, then it probably makes sense to do an RPC call.

However, if you are trying to upload, say, a use profile picture, then it probably makes more sense to:
1) do an RPC call to generate a pre-signed URL
2) upload the said file to S3/S3-compatible storage with the URL
3) do another RPC call with the URL, so the remote service can process.

This would avoid the slow consumer problem and reduce the bandwidth usage in the transporter channel (especially if you are using gnatsd then it has strict some requirements).

218

Was this page helpful?
0 / 5 - 0 ratings

Related issues

developez picture developez  路  5Comments

nurdism picture nurdism  路  3Comments

SushKenyNeosoft picture SushKenyNeosoft  路  3Comments

DeividasJackus picture DeividasJackus  路  4Comments

ngraef picture ngraef  路  4Comments