Camunda BPMN http-connector POST taskId - bpmn

I created a BPMN using the Camunda BPMN Modeler. Now I have a Service-Task with an BPMN-Error:
The Service-Task should call a REST-API using the http-connector. Sending the request the TaskId needs also to be send so that I can call the BPMN-Error-Rest-Url in case of errors.
How do I configure the BPMN to send the TaskId as Query-Parameter in the URL respectively what is the correkt taskId-Expression-Key?

Try:
http://www.my-apid.de?taskId=${execution.activityInstanceId}

Related

Elsa Workflow - Fork (Control Flow)

Could someone please explain how Fork from Elsa Workflow works?
I have set up HTTP Endpoint. After that I send HTTP Request and I get HTTP Response in JSON format.
I want to set condition on that response (for example name='John') so that I could display only that row from database.
What Elsa activity should I use? Is Fork activity correct choice or other?
Fork
The Fork activity simply forks workflow execution into multiple branches. When you add this activity, you specify a list of one or more branch names. These branch names will be scheduled as activity outcomes.
For example, if you add a Fork activity with branches Do Some Request and Timeout, the Fork activity will show these branches as outcomes.
When the Fork activity executes, both branches will execute. This enables scenarios where you for example want to wait for some user input or some other job to finish, but not indefinitely: you have a second branch that waits for a timeout event using e.g. the Timer activity.
A sample workflow that describes the usage of the Fork activity in a similar scenario can be found here.
That describes the use case of the Fork activity. But you will want to use the If activity instead.
If
Going back to your use case with the HTTP Request activity and setting a condition, what you want to use instead of Fork is the If activity.
When you connect an If activity to HTTP Request, you will be able to write a JS expression that must evaluate to true or false.
For example, let's say your Send HTTP Request activity performs a GET request on https://reqres.in/api/users/2
Make sure that the Read Content checkbox is ticked.
Also make sure to give your Send HTTP Request activity a name. For example, SendHttpRequest1.
With that in place, you can now write the following JS expression in the Condition field of the If activity:
activities.SendHttpRequest1.ResponseContent().data.first_name == 'Janet'
Note that activities.SendHttpRequest1.ResponseContent() returns an ExpandoObject that represents the received JSON response from the demo API endpoint I used in my example.

mule4 batch - how to send oncomplete phase response to http listner?

I have common scenario but I am not able to figure out the solution in Mule 4 batch. In my flow I have a http listner which invokes the flow and then I am calling DB select and then using a batch to upsert data into salesforce.
by default batch will create stats in On-Complete phase and my requirement is to send exact stats as response but I am not able to access it outside of batch. Tried with vars, attributes and even tried VM publish (in this case response will not go back to listner)
Can someone please guide me on this? I'm attaching the flow design for reference.
flow design
Thanks.
You can't. Batch works in the background, your flow will be long gone before your batch is done.
My suggestion is you (1) Store the reporting data somewhere and (2) get to the data using another request/way.
Here's the documentation: https://docs.mulesoft.com/mule-runtime/4.2/batch-processing-concept
You can store the payload in on-complete phase in an objectStore and can retrieve it later to build your report. The payload stored in the on-complete phase is a java object that has properties that you would need to build your report. (For e.g.loadedRecords, failedRecords etc)..

Capture start of long running POST VB.net MVC4

I have a subroutine in my Controller
<HttpPost>
Sub Index(Id, varLotsOfData)
'Point B.
'By the time it gets here - all the data has been accepted by server.
What I would like to do it capture the Id of the inbound POST and mark, for example, a database record to say "Id xx is receiving data"
The POST receive can take a long time as there is lots of data.
When execution gets to point B I can mark the record "All data received".
Where can I place this type of "pre-POST completed" code?
I should add - we are receiving the POST data from clients that we do not control - that is, it is most likely a client's server sending the data - not a webbrowser client that we have served up from our webserver.
UPDATE: This is looking more complex than I had imagined.
I'm thinking that a possible solution would be to inspect the worker processes in IIS programatically. Via the IIS Manager you can do this for example - How to use IIS Manager to get Worker Processes (w3wp.exe) details information ?
From your description, you want to display on the client page that the method is executing and you can show also a loading gif, and when the execution completed, you will show a message to the user that the execution is completed.
The answer is simply: use SignalR
here you can find some references
Getting started with signalR 1.x and Mvc4
Creating your first SignalR hub MVC project
Hope this will help you
If I understand your goal correctly, it sounds like HttpRequest.GetBufferlessInputStream might be worth a look. It allows you to begin acting on incoming post data immediately and in "pieces" rather than waiting until the entire post has been received.
An excerpt from Microsoft's documentation:
...provides an alternative to using the InputStream propertywhich waits until the whole request has been received. In contrast, the GetBufferlessInputStream method returns the Stream object immediately. You can use the method to begin processing the entity body before the complete contents of the body have been received and asynchronously read the request entity in chunks. This method can be useful if the request is uploading a large file and you want to begin accessing the file contents before the upload is finished.
So you could grab the beginning of the post, and provided your client-facing page sends the ID towards the beginning of its transmission, you may be able to pull that out. Of course, this would be reading raw byte data which would need to be decoded so you could grab the inbound post's ID. There's also a buffered one that will allow the stream to be read in pieces but will also build a complete request object for processing once it has been completely received.
Create a custom action filter,
Action Filters for executing filtering logic either before or after an action method is called. Action Filters are custom attributes that provide declarative means to add pre-action and post-action behavior to the controller's action methods.
Specifically you'll want to look at the
OnActionExecuted – This method is called after a controller action is executed.
Here are a couple of links:
http://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2016/03/04/how-to-create-a-custom-action-filter-in-asp-net-mvc.aspx
http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/understanding-action-filters-vb
Here is a lab, but I think it's C#
http://www.asp.net/mvc/overview/older-versions/hands-on-labs/aspnet-mvc-4-custom-action-filters

How to automate run an mule application

I have a mule flow and I want to automate the execution of the application without http listener
I want the mule application execute without enter "localhost:8081/app"
is it a way to do this?
Screenshots of the flow
As I understood from your question, I can suggest the below steps
1) Add Composite source at the start of your flow.
2) Place the existing HTTP inbound endpoint into Composite source scope.
3) As an addition, add the quartz inbound endpoint into composite source scope and configure it at what time you want to run using cron expression.
This approach enables you option to trigger the flow using either HTTP URL or automated execution through quartz component using cron expression.
Please comment on this answer if you feel my understanding is wrong.
Do you simply want the app to run at scheduled intervals? If so, I think the Quartz connector would be you best choice.
Is this the scenario you are after?

How to capture the response object from a webhook call

I am creating a Rails 3.2 app and I am using Paymill as the payment gateway.
I am trying to setup a webhook on my system (Already setup on Paymill side). This webhook should respond to callbacks when a transaction was successful.
How can I "capture" the response object in my code? Using params?
Thankful for all help!
I don't know paymill, but it looks like it works the same way as stripe.
Thus, you have to handle the response with params.
You can have a look on this code sample: https://github.com/apalancat/paymill-rails
A webhook call from Paymill includes a JSON in the request. This JSON includes some meta data about the event that was triggered and the objects affected. So, you'd have to take the request body and parse the JSON to extract the information you are looking for. You can see a sample JSON file here:
https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#events