Azure Logic Apps- Standard Stateful - azure-logic-apps

I understand that Azure standard Stateful Logic app workflow runs Asynchronously but can i use stateful standard logic app for the below scenario:
We want to receive Json data from the third party in a HTTP post request, then process it and store it in Azure data lake. But the problem is since Azure standard stateful workflow runs asynchronously as soon the http trigger is hit it returns Status 202 Accepted. I want to send the caller end status of the request. For example- I want to send 500 Internal server error when the request was valid but still the workflow failed due to an internal error. If the data was processed successfully i want to send the caller HTTP Status 200 Ok. I dont want to send always HTTP status 202 Accepted to the caller. I want the caller to know what exactly happened to their HTTP request. Is it possible through standard logic app? I dont want to use consumption Logic app because of security reasons.

You can achieve this using runafter configuration by enabling this configuration it runs even after the whole workflow is getting failed.
Go to your work flow and select Menu for the action you want to run regardless if the previous one is about to fail, timeout, or skip. It's Condition in my case, and then 'Configure run after'.
For instance here is my logic app
Here is how my code view looks like :
OUTPUT:
UPDATED ANSWER
In that case, too you can use the same runafter concept with the condition having status code is not equal to 200 as a true statement and continue the flow
Here is the logic app
Here is the output

Related

How to read azure service queue message in Logic apps?

I am trying to create small Azure Logic app which will have some order flows.I will get the message in service bus queue. I need to get the message in logic app and based upon the message content, I need to follow the further steps. The message will contain the order data as well. There will be conditional logic, let's suppose, if order type is "new", I need to call HTTP request where I need to pass the message data as body content in POST request.
I have create a service bus queue and in logic apps, added service bus trigger which will be called when message will be received in service bus queue(automatically).
I need to able to implement conditional logic but as i am newbie in this, i am not sure how to pass this data in condtional logic from message.
You just need to mention the condition in the block and design the flow that we require. If the condition is true I have added the HTTP action mentioning the required details. For understanding purpose I have mentioned the other condition to trigger an email.
Here the flow of my logic app
If you want to continue the flow just click Add an action in True Connector.
REFERENCES:
Get started with Azure Service Bus queues (Azure.Messaging.ServiceBus) - Azure Service Bus | Microsoft Docs

Display realtime data in reactjs

I'm sending data from my backend every 10 seconds and I wanted to display that data in reactjs. I've searched on the net to use socket.io to display real-time data. Is there a better way to use it?
If you're dead set on updating your data every 10 seconds, it would make more sense to make a request from the client to the server, as HTTP requests can only be opened from client to server. By using HTTP requests, you won't need to use socket.io, but socket.io is an easy alternative if you need much faster requests.
Depending on how you are generating the data being sent from your backend, specifically if you are using a database, there is most likely a way to subscribe to changes in the database. This would actually update the data in realtime, without a 10 second delay.
If you want a more detailed answer, you'll have to provide more detail regarding your question: what data are you sending? where is it coming from or how are you generating it?
I'm working on an autodialer feature, in which an agent will get a call when I trigger the button from the frontend (using react js language), and then automatically all the leads in the agent assigned portal will get back-to-back calls from agent number. However, because this process is automatic, the agent won't know who the agent has called, so I want to establish a real-time connection so that I can show a popup on the frontend that contains information about the lead who was called.

Azure Logic App - Manual trigger with user entered parameters

I've got a logic app that I want to be able to run ad hoc and specify the parameters when run. The closest manual trigger i could find was the HTTP request.
As a workaround, I'm calling it from postman where the JSON body can be defined.
While postman works, I'm looking for a way to trigger the app from within azure and provide the JSON body.
Thank you
Actually there are many way to trigger the logic app and process the json data.
You could try with service bus trigger or blob trigger, the below is my test with servicebus. I send a json message with Service bus Explorer. Note: in the logic app the json data is encoded with base64.
The below is the result.
However from the action you could find it has a Interval property to set, it means it may be not triggered immediately. And mostly other triggers need to set the Interval, so if you want to trigger immediately, suppose the HTTP request is the best.
My workaround is a Recurrence trigger every 1 minute and let it kick off and then edit the trigger to every 1 month and save it. Then I disable the Logic App to make sure it does not trigger automatically.

Azure Logic App: HTTP POST in For Each loop shows unauthorized error

We have a problem with our logic app if we process multiple files in a For Each loop and try to do a HTTP POST to a Third-Party. Each file can have different urls/usernames/passwords for the HTTP POST step. This is why set username/password/url variables in our For Each.
Tests:
If we test all these url's with logins with postman, it works.
If we test different files with different username/password/url variables (but only one at a time per run) in our logic app, it works.
If we test files with the same username/password/url for HTTP POST variables, it works.
If we process multiple files at the same time with different usernames/passwords/url's for the HTTP POST step, it fails with some http posts in the for each showing UNAUTHORIZED, but if we check all the variables set for each file in the for each step it sets the correct username/password/url, these are correct.
Our conclusion:
If the http post gets dynamic variables (username/password/url) in a for each step some only some http post work. But for files with other login data, it fails. Looks like the HTTP connector cannot handle dynamic multiple http calls with different variables.
Our http post step:
Our if true condition inside a for each step (unautorized error while all login and url variables are correct):
Are we doing something wrong? Please help as we are trying to move this to production.
For Each loop in Logic Apps runs its iterations in parallel by default -- so if you've designed your workflow such that correct pair of username and password for their corresponding HTTP POST are determined at runtime in each iteration, based on original order of collection the loop began -- it'll probably produce the behavior you're observing. Assuming that was the case, have you tried running the loop with Sequential option on?
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#sequential-foreach-loop

Showing status of a batch update operation using WebApi

I need to know how to update UI with the status of a batch update operation. For example i am sending a request to WebApi to update multiple records (could be any number of records), now i want to show the status of each record to client side.
Please suggest me the best way of doing that. I am using WebApi, Angular. I am thinking about implementing SignalR that can update Client UI with respect to the status but is there an another way of doing that ??
signalr may be overkill for what could be a simple polling request to your api.
It's a little ambiguous as to exactly what it is you are doing with your batch update operation, but since your looking to get status back I'm going to assume it's a long slow operation that your not waiting on a response for in the initial request.
Web api has REST principles baked into it from the start so I imagine your batch update operation is using a PUT with a set of objects that need to be updated. If so you could simply request those objects back from your api to check their state and see if the operation has updated them yet.
If your not doing a simple PUT on an entity and it's more like a POST to submit a batch operation you should persist the operation entity and return a reference to it in the initial call then subsequently poll for that operation by id to get its current status.
signalr might let it feel a little more realtime by immediately pushing completed events down to the client but it can also bring a lot more overhead for what you are trying to achieve

Resources