Im trying to add a process instance using this post request to /message
{
"messageName" : "DocumentReceived",
"businessKey" : "3",
"processVariables" : {
"document" : {"value" : "This is a document...", "type": "String"
}
}
}
But instead of getting 1 instance im getting 2 instances of the same id and same everything, I tried creating a process directly from the webapp (TaskList) but it still creates 2 duplicates, and i noticed one the instances gets stuck on user task while the other can just pass it without doing anything, ill attach a screenshot after running the post request above
Check your process model carefully. I believe you accidentally have two outgoing sequence flows on the start event. One connects to the user task, the other connects directly to the gateway. Because the two flows overlap, it is hard to spot. However, when you look closely at the "Send the new document" user task, you can see a faint line passing "behind" the task. Move the user task model element 3 cm up and you will see what is wrong.
Related
I have been trying out the Camunda BPMN engine for a couple of days.
Using the REST API, I have managed to start a process instance and associate it with a business key. However, I realized that it is possible to start multiple process instances under the same business key. Is there a way to enforce a condition such that only one process instance is allowed per business key per process definition?
Thank you.
One way is to check in the process (synchronously) if a process with this businessKey already exists when a process is started.
Here is a related example model which only allows one instance of the definition:
https://raw.githubusercontent.com/rob2universe/process-models/master/bpmn/singleton.bpmn
The interesting part is the expression:
${historyService.createHistoricProcessInstanceQuery().processDefinitionKey(execution.getProcessDefinitionId().split(":")[0]).active().count() > 0}
You can change the filter criteria in the query to check the businessKey instead of the process definition key.
We use the following pattern to solve this:
This is an Event Sub Process.
Now Correlate Message, like
curl --location --request POST 'http://localhost:8080/engine-rest/message' \
--data-raw '{
"messageName": "message",
"businessKey": "my-unique-bk",
"processVariables": {
}
}'
First time: Starts the Process.
Second Time: Starts the Event Sub Process.
I want to setup a simple Amazon Connect call-flow that dials back any customer who leaves behind a phone number on my website. I am a rank beginner at Amazon Connect and cannot find any example code showing how to setup outbound calling to dynamically supplied phone numbers via a web-client.
Can someone point me to any example code. I have seen documentation of AWS Connect APIs including those for StartOutboundCall etc but am looking for some example code if possible.
https://blogs.perficient.com/2018/11/19/ac-outbound-api/ has a good example, that I've followed successfully.
The call is:
let params = {
"InstanceId" : '12345l-abcd-1234-abcde-123456789bcde',
"ContactFlowId" : '987654-lkjhgf-9875-abcde-poiuyt0987645',
"SourcePhoneNumber" : '+1xxxxxxxxx',
"DestinationPhoneNumber" : customerPhoneNumber,
"Attributes" : {
'name' : customerName,
'dayOfWeek' : dayOfWeek
}
}
let connect = new AWS.Connect();
connect.startOutboundVoiceContact(params, function (error, response) { ... });
Given a contact flow (of type "Contact Flow"), with arn: arn:aws:connect:us-east-1:xxxxxxxx:instance/12345l-abcd-1234-abcde-123456789bcde/contact-flow/987654-lkjhgf-9875-abcde-poiuyt0987645
The SourcePhoneNumber is required and must be one of those in your Amazon Connect. Or use a queue number if you have any defined.
The Attributes property will be passed as-is and will be available in text-to-speech, in your Contact Flow, with a form similar to $.Attributes.dayOfWeek.
The Contact Flow can be as simple as one Start, connected to one 'Play Prompt', connected to 'Disconnect/Hang up'.
All props go to https://blogs.perficient.com/author/dhodanic/
I am a new for camunda.
I want cancel the currently running activity instance and start a new activity instance for move the token state.
But I got a hard time of how get the currently running activity instance id by the java api of camunda.
Any thougs ? Thank you all.
Actully the question is "How get the running activity instances". And I already got the answer from somewhere.
Here is the aswer.
Just use the java api like below
ActivityInstance activityInstance = runtimeService.getActivityInstance(instance.getProcessInstanceId());
ActivityInstance[] activityInstances = activityInstance.getChildActivityInstances();
The activityInstances array is the running activity instances. you can use the ids of the activity instances to cancel running activity instance.
Had the same trouble. This line returns a list of ids (whatever they are - user task, service task, and etc). If you don't have parallel active tasks - the list will contain a single activity id.
processEngine.getRuntimeService().getActiveActivityIds(
processInstance.getProcessInstanceId()
);
I built the BookTrip bot from Amazon Lex detailed here.
When chatting with the bot the user can continue to book hotel rooms or rent cars until they end the conversation. Here is an example of a successful reservation followed by another reservation attempt through the chatbot interface:
When I use this chatbot in an Amazon Connect contact flow the user is not able to continue booking anything past the first reservation. Logically, the contact flow would keep executing the BookHotel or BookCar intents until the ConnectToAgent or EndConversation intents are executed.
I have tried looping BookHotel and BookCar back to the beginning of the "Get customer" input block but that errors out.
The best way to do this is keep the user in the bot until they have done all of their booking, and then exit back to Amazon Connect. You would do this in the following way:
Get slot values for initial booking
Use lambda to fullfil the intent (write to database, etc.) and clear the slot values
Use ConfrimIntent to as ask “would you like to add another booking”
If the user responds “yes”, confirming the intent then you would elicit the slot values (starting over at step 1)
If the user responds “no”, you would exit back to Amazon Connect
You can check out the lambda request and response details here
There is also a good discussion about this pattern on the AWS developer forum here.
I found one way around this that works for when you have multiple intents, though there are a couple drawbacks.
Basically, create a dummy block in Amazon Connect. I use Set Contact Attributes with a dummy attribute I named 'continue' with the value of 'continuing'. It is never used. Then on Success, loop it back to restart the Lex block!
No error when saving and publishing and works well for my use case.
Here's how the image above's set up works:
A. Play welcome prompt (this used to be the prompt when the Lex block initiated)
B. "Get customer input" is the Lex block.
C. Lex ends any intent and moves to dummy block (Set contact attributes)
D. On Success of setting dummy attribute, move back to restart B. Lex block.
Here are the drawbacks:
1. The Lex block requires some prompt when it initiates so you will have to design that into your bot, since it will deliver a prompt at the close of your intent, then another prompt at the restart of the Lex block.
2. This creates an infinite loop, at least until the user ends the call, or the session times out. One way around this though is to create an intent specifically for saying goodbye and don't point that intent fulfillment to the dummy block.
What I have implemented and successfully tested is adding "Greeting", "Yes" and "No" intents. When a real intent is fulfilled, I transfer the contact to the next Get customer input block that ask if the bot can help with anything else and checks for "Yes" and "No" intents. "Yes" transfers to the main Lex block. "No" obviously exits.
The key thing to me here is how do you set your text greetings so it doesn't seem confusing. Please see what I came up with on the flow diagram. Seems to be working to me.
P.S. Didn't test it in production.
I have a simple service (C# web service) that accepts an integer and returns an integer, i have tested it using Storm it is working properly.
Now i am calling this service in a for loop in a file with around 2000 records approx, this service is failing giving the above error with some records. If i run the error file it goes through as if nothing was wrong, what might be the problem please help.
The error doesn't seem related to it being a web service call: it seems to indicate you either tried to GetEntity and passed in a zero/NullIdentifier() (not a valid Id), or maybe you tried an CreateEntity and that entity has a foreign key that is not filled in (i.e. zero/NullIdentifier() again).
I would start by checking the logic inside the WS method for those action calls and the inputs you are using there.