Reputation: 101
I have a service bus triggered function, and would like to email the message to a specific recipient. I have already setup Sendgrid and tested a function that can send emails. I want to trigger this email function whenever a message arrives in the queue.
I have also setup all the required parameters for the queue.
Upvotes: 0
Views: 6717
Reputation: 1668
I would suggest to decouple the entire functionallity you want to share including, including orchestrationtriggered and activitytriggered functions in a separated class; added with dependency injection; and then call it from your multiple functions.
Otherwise as other have suggested, the recommendation is or comunnicating with Queue Storage or using Logic Apps (https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices#cross-function-communication)
Upvotes: 0
Reputation: 12228
You can use either a HTTP trigger, or a storage queue trigger to initiate other functions.
If you use a webhook, and use the masterKey from D:\home\data\Functions\secrets
by setting the authorisation to admin, you can ensure that only the masterKey can be used. (there is more at https://azure.microsoft.com/en-us/documentation/articles/functions-bindings-http-webhook/ )
Typically you would use a webhook if you need a response and a storage queue if you want a fire-and-forget (since you can't easily get a response into the calling functions execution)
This also gives you the ancillary benefit of being able to run functions in multiple languages without needing to worry about exchanging data.
Upvotes: 1