Trigger java code to download file from onedrive when file is uploaded to onedrive

主宰稳场 提交于 2019-11-28 11:50:49

问题


I want to trigger a java code residing as an image in Azure container registry or docker hub. This code is to download/read file from onedrive when file is been uploaded to onedrive.

I tried azure services like Azure logic apps but there is no action to trigger java code. I tried using restapi but couldnt identify the URL to use for GET request. I read about microsoft graph api but I dont have to use it as I have to make it generic in case in future file path changes from onedrive to any other drive.


回答1:


Here are the steps which you need to follow:

1) You will create a logic app which will have the trigger for one drive file upload.

2) Next action is to create Azure function which will have http trigger with the type post.

3) Logic app file output will behave like input for Azure function which will be your Java base code.

4) You can write the processing logic in your azure function.

Alternatively, you can have an Azure function too which will watch over your One Drive file and later on you can process it .

Here is a similar thread for same scenario.

Process a file using Azure Function

Hope it helps.




回答2:


The simple solution is using External file trigger in Azure Functions, as the figures below, please refer to the offical document Microsoft Graph bindings for Azure Functions to know how to do.

For example, using JavaScript.

But due to not support this trigger for Java on Azure Functions, you can only use C#/F#, JavaScript/Node.js to realize it.

If you must have to do in Java, a workaround way is to integrate Azure Functions with HttpTrigger or WebHook with the OneDrive trigger of Azure Logic App.


The code of Azure Logic App is a json data block to define the logic flow, as below, you can see it in the tab Logic app code view of Azure portal.



来源:https://stackoverflow.com/questions/55505659/trigger-java-code-to-download-file-from-onedrive-when-file-is-uploaded-to-onedri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!