问题
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