I would like to know if it is possible to cancel an execution of an ScheduledActivity.
Example:
A SchedulableState of type A is created, and the scheduledActivity will execute a flow that creates another SchedulableState of type A. It means that the app will always execute the flow determined in the activity and create another state of type A.
How can I abort the execution of the activity?
How can I identify if is there a ScheduledActivity waiting to be executed?
As of Corda 4.x, there is no API to cancel scheduled activities.
Instead, you'd have to connect to the node's database directly and drop the required rows from the node's NODE_SCHEDULED_STATES table.
Related
I am working on Spring Kafka implementation and my use case is consume messages from Kafka topic as batch (using batch listener). when I consumer the list of messages, will iterate and call the REST endpoint for message enrichment. In case REST API fails for any runtime exception, I have implemented retry logic using spring retry. I want to stop the container, after the number of retries fails. So planning to use KafkaContainerStoppingErrorHandler to achieve this. Does the KafkaContainerStoppingErrorHandler commits the previous success messages - say if we receive 10 messages, and for message 1,2,3,4, enrichment call is success and for message 5 enrichment API call fails. so when we restart the container, will I get all 10 again or will I receive messages 5- 10?
or is there a way we can achieve above use case? I looked into all types of error handles of Spring kafka and need input on how to achieve above requirement.
You will get them all again.
You can use the DefaultErrorHandler (with a custom recoverer) and throw a BatchListenerFailedException to indicate which record in the batch failed.
The error handler will commit the offsets up to that record and call the recoverer with the failed record; in your custom recoverer you can stop the container (use the same logic as the container stopping error handler).
In versions before 2.8, this same functionality is provided by the RecoveringBatchErrorHandler.
How to get the user who initiated the process in IBM BPM 8.5. I want to reassign my task to the user who actually initiated the process. How it can be achieved in IBM BPM?
There are several ways to get that who initiated a Task , But who initiated a process Instance is somewhat different.
You can perform one out of the following :
Add a private variable and assign it tw.system.user_loginName at the POST of start. you can access that variable for user who initiated the process.(It will be null or undefined for the scenario if task is initiated by some REST API or UCA.)
Place a Tracking group after Start event . Add a input variable to it as username , assign it a value same as tw.system.user_loginName. So whenever Process is started entry will be inserted to DB Table.You can retrieve this value from that view in PerformanceDB.
Also there might be some table ,logging the process Instances details , where you can find the user_id directly.
I suggest you to look in getStarter() method of ProcessInstanceData API.
Official Documentation on API
This link on IBM Developerworks should help you too: Process Starter
Unfortunately there's not an Out Of The Box way to do this - nothing is recorded in the Process Instance that indicates "who" started a process. I presume this is because there are many ways to launch a process instance - from the Portal, via a Message Event, from an API call, etc.
Perhaps the best way to handle this is to add a required Input parameter to your BPD, and supply "who" started the process when you launch it. Unfortunately you can't supply any inputs from the OOTB Portal "New", but you can easilty build your own "launcher".
If you want to route the first task in process to the user that started the process the easiest approach is to simply put the start point in the lane, and on the activity select routing to "Last User In Lane". This will take care of the use case for you without requiring that you do the book keeping to track the user.
Its been a while since I've implemented this, so I can't remember if it will work elegantly if you have system steps before the first task, but this can easily be handled by moving the system steps into the human service to be executed as part of that call, rather than as a separate step in the BPD.
Define variable as string type and using script task to define the login user that use this task and assign it to your defined variable to keep to you in all of the process as initiator of the task.
You can use this line of code to achieve the same:
tw.system.user_loginName
How the workflow runtime knows about its activity order and parameter. Can we alter the execution behaviour or order of activity execution in runing workflow?
My requirment is how to control the activity execution so that we can explicitly get current execution activity , stop, re run and change parameter.
We can alter the execution order by creating custom control flow activity. This can be done by inheriting NativeActivity.
For example, creating custom sequence activity you can go through this example.
http://code.msdn.microsoft.com/VBWF4CustomSequenceActivity-cd65cb4c
I have an Activity( waiting for an approval ) that contains a WhileActivity. In the while activity I want to read the value of an argument - if it returns true I execute I continue with workflow execution, otherwise I stop the hanging the executing till the argument value turns true
How can I do this - for a while or other activities - ?
Thank you
If the value you are waiting on is being changed by another activity you can use a TrackingParticipant to watch for the value changing and when that happens resume a bookmark to notify your waiting activity.
Sounds more like your requirements would be better served by a State Machine workflow.
Okay, so you don't want to use a State Machine workflow. So, here's how you do it.
You have to create a custom Activity that is used in conjunction with a Workflow Extension. An Extension is just an object that can be accessed by your Activities as the workflow executes and allows your Activities to communicate with the classes that are executing the workflow.
Your custom Activity must be able to create a Bookmark and offload the Workflow. It does this while you wait for the correct value from your Extension. You don't need to do this in any While Activity loop. You just do the following
Get your Extension
Get the current value you are evaluating on
If you aren't happy, create a bookmark
When the bookmark resumes, go to step 1.
If you are happy, continue execution.
In Flex, I'm making a set of asynchronous calls:
service.method1.send().addResponder(responder1);
service.method2.send().addResponder(responder2);
service.method3.send().addResponder(responder3);
I want to execute some code after all of these service calls have returned (either success or failure, I don't care which). How can I do this?
Implement a CallResponder that will monitor the results from each responder & increment a variable in the listener after each result. When the variable hits three, execute some code.