I am +1 for the second option of retrieving the image as a binary stream.

Given the fact that images can be of varying sizes (talking about
high-resolution ones, here), and Sidhdhi not having any image processing
capabilities as of this moment, I do not see a clear advantage in using a
SIdhdhi stream for storage and retrieval.

Thanks and Regards,

Ruwan Yatawara

Technical Lead,
WSO2 Inc.

email : ruw...@wso2.com
mobile : +94 77 9110413
http://ruwansrants.blogspot.com/
https://500px.com/ruwan_ace
https://medium.com/@ruwanyatawara


On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene <nuw...@wso2.com> wrote:

> Hi all,
>
> I'm currently working on a project to add image storing and retrieval
> capabilities to the WSO2 IoT Server.
>
> To achieve this I have implemented the following;
> 1) Added a separate DAO Table with a field with LONGBLOB data type for
> storing.
> 2) Added storage capabilities in the database for an image sent as a *File
> *in the form of a *BinaryStream*.
>
> As of now, I've written unit tests and the test images are getting stored
> successfully in the database.
>
> The problem lies in how to successfully retrieve the stored data. For
> this, I have come across 2 possible approaches.
> 1) *Retrieve as a File - *The notable downside I realized with this
> solution is that each time a new Image is retrieved, a new file will be
> created. Therefore measures would have to be taken to persist new files
> while purging older obsolete ones.
> 2) *Retrieve as BinaryStream - *Although this requires no persistent
> memory usage and the data will only be retrieved on call and issues may
> come up when representing that data from a UI end. Further analysis is
> required for this approach.
> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
> one recommended mostly in forums and tutorials.
>
> One other approach suggested to me was to use a *Siddhi Stream for both
> storage and retrieval* purposes. This would further allow for analytics
> to be performed on the data which not be very much possible with the
> earlier mentioned approaches.
>
> Suggestions and Feedback are appreciated.
> Thanks and regards!
>
> --
> *Nuwan Jayawardene*
> *Software Engineering Intern*
> *WSO2, Inc.:http://wso2.com <http://wso2.com/>*
> *lean.enterprise.middleware*
> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>
>
>    - *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>    <https://www.linkedin.com/in/nuwanjaya/>**njaya/
>    <https://www.linkedin.com/in/nuwanjaya/>*
>    - * <https://www.wso2.com/signature>*
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to