Sam
Sam

Reputation: 30344

Azure function calling another Azure function

I want to build an Azure Function that responds to HTTP POST requests coming from another Azure function i.e. MasterFunction calling NotificationsFunction.

Say, I have the following simple POCO object:

public class Car
{
   public string Make { get; set; }
   public string Model { get; set; }
   public int Year { get; set; }
   public int Mileage { get; set; }
}

Both functions will be sharing the same class library containing these POCO objects.

Am I right to assume that in the MasterFunction, I'll have to serialize my Car object to JSON, then make an HTTP call?

Could someone point me to some code samples on a similar scenario?

Upvotes: 2

Views: 4807

Answers (2)

Pankaj Rawat
Pankaj Rawat

Reputation: 4583

If I understand correctly you want service communication between services/endpoints. You can use Orchestration or choreography for service communication. orchestration in azure using 1. Durable function 2. Logic app Choreography in azure using 1. Storage queue 2. Service Bus.

Hope it will help

Upvotes: 0

akardon
akardon

Reputation: 46036

If both of your functions are in the same azure function app (which I think that's the case), I'd say the best way of calling other functions is using Queues.

In the sense that you put your POCO into a queue and define your second function with a QueueTrigger. So once an object gets into the queue, the other function gets called automatically and the object get dequeued.

You can find samples and more details in here : https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue

Upvotes: 3

Related Questions