0

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.

Lani
  • 178
  • 1
  • 2
  • 9

2 Answers2

0

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.

enter image description here

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.

Mohit Verma
  • 5,140
  • 2
  • 12
  • 27
0

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.

enter image description here

For example, using JavaScript. enter image description here

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.

enter image description here

enter image description here


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.

enter image description here

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • Thank you for the response. Sorry I am new to these Azure services so my question could be very silly. Can this code be version controlled and how can I run this whole code as a docker image? – Lani Apr 04 '19 at 16:45
  • @Lani If you would like to use Azure Functions, this way requires you to write codes and deploy it to Azure. Or you would like to use Azure Logic App, you just need to configure these connections and actions without any code to make it works and you can see its code in the tab `Logic app code view`, the code is a json string. I have updated my post for Logic app code view. – Peter Pan Apr 05 '19 at 02:27