Search code examples
azureazure-functionsazure-sql-databaseazure-logic-appsazureservicebus

How to send the contents of a newly created row in an SQL Azure Database to a Service Bus Queue using Logic Apps?


I am trying to implement a very basic functionality, as follows: when a row is added in an Azure SQL Database the contents of that row are sent to a Service Bus Queue.

How to add row contents to 'Send Message' content

(1)How do I send the 'row' as parameter to the 'send message content'? (2)What kind of object does 'get row' create, and what kind of formatting does it need to be sent over to the Service Bus Queue? (3)Can't this whole operation be done with an Azure Function, rather than logic apps ? (I couldn't find an SQL trigger for Azure Functions).

Thank you in advance.


Solution

    1. We have created logic app as shown below:

    enter image description here

    1. Created a compose action to get newly added row content as shown below: enter image description here

    2. Assigned value of compose to a variable as shown below:

    enter image description here

    1. In send message action, giving value of variable in content. enter image description here

    2. Logic app ran successfully. enter image description here

    3. Message received in service bus queue. enter image description here

    4. You can get primary column by writing expression as “triggerBody()?[primarycolumnname]” enter image description here