Can you set the Instance ID of a new BPMN Process Instance? - wso2

I can now start a new BPMN process using the REST API. What I did notice is that I do not set the Instance ID. I get that value in the return. Is it possible to set the ID ? We use that as the primary key on other places. So I would like to be able to tell the BPMN what ID to use for the instance of the process. It seems I am getting random numbers coming back.

OK so it seems you can set the BusinessKey to a value that you know end search with it. So it is similar to what I what.

Related

Dynamically Create Cloud Run or Function determined by attribute in pub/sub

I am trying to get a Cloud Run or Cloud Function to start and pull out messages that match its defined ID, for example, if a message with attribute ID 1 is put into the topic, The Cloud Run with ID 1 will take it out, it's important that all messages with attribute 1 go to the same instance.
I understand I could use filters on the subscriptions but I would like to able to easily change the amount of possible ID's, e.g. If I only put messages in the topic with ID's ranging between 0 and 4 then only five instances would be started.
How would I go about creating something like this? Does Pub/Sub support this sort of functionality?
I know I could create X amount of topics and then put each message into its own topic but that seems like a inefficient way of executing this when there is the attribute system.
This was not possible, I had to instead, wait for all data for the desired function to be ready before starting the function, I could not have it continually poll and get the correct data.
Therefore the best approach was to put the data into a firestore, then when all the data was ready for the next layer to process it, I would put a message in a pub sub that contained a message ID, this message ID would determine the data that this function would process.
The function would then query the firestore for messages with a property that included the message ID it was given.
I could not find any other work approaches that would give me the result I desired.

Assign a process Instance in Camunda

i am using camunda REST i would like to know whats the best way to work with task / process Instance assignments. There is a REST call that assigns a single task to a user but after submitting the task the assignment is lost.
My goal is to assign the complete process Instance to a person. But i am not sure if this rly makes sense or not and if yes then how ?
If this is not possible or doesnt make sense, how would you handle the fact that after submitting a task the assignment is lost ? Would you reassign every time the next task?
Thank you
It could totally make sense to assign all user tasks of a process to a specific user or group.
You could model this in the bpmn by setting the assignee to a variable (${assignee}) and then just set this variable once on the process instance. All tasks then are automatically assigned to the user named in the variable.

Tenant ID setting in case of "startBeforeActivity"

ENV: Camunda 7.5
Approach: Single Process Engine With Tenant-Identifiers with Transparent Access Restrictions for Tenants
Given: foo is a process definition key which is deployed without tenant ID, i.e. shared process among all tenants. bar is the ID of a service task within foo.
The TenantIdProvider works well if one start process instances normally (startXXX or startXXXByMessage). For test cases which don't start process instances this way, rather with:
runtimeService.createProcessInstanceByKey('foo')
.startBeforeActivity('bar')
.execute()
the tenant ID doesn't get set. Maybe someone can point out why and how. Thanks!
Not implemented yet. See also: https://app.camunda.com/jira/browse/CAM-6218

How can I write data about process assignees to database

I use camunda 7.2.0 and i'm not very experienced with it. I'm trying to write data about users, who had done something with process instance to database (i'm using rest services) to get some kind of reports later. The problem is that i don't know how to trigger my rest(that sends information to datebase about current user and assignee) when user assignes task to somebody else or claims task to himself. I see that camunda engine sends request like
link: engine/engine/default/task/5f965ab7-e74b-11e4-a710-0050568b5c8a/assignee
post: {"userId":"Tom"}
As partial solution I can think about creating a global variable "currentUser" and on form load check if user is different from current, and if he is - run the rest and change variable. But this solution don't looks correct to me. So is there any better way to do it? Thanks in advance
You could use a task listener which updates your data when the assignee of a task is changed. If you want this behavior for every task you could define a global task listener.

get a permanent browseNodeId from amazon product API

I'm using Amazon Product API to get new products of certain category everyday.
Sometimes the BrowseNodeId changes, let's say I want to get new books about 'Python', at the moment I'm calling Amazon API like this:
get_new_products(BrowseNodeId=36848)
but sometimes BrowseNodeId changes and I get this error:
InvalidParameterValue: AWS.InvalidParameterValue: 36848 is not a
valid value for BrowseNodeId. Please change this value and retry your
request.
What can I do to keep the BrowseNodeId of Python updated? Which API should I use to get the BrowseNodeId passing the string 'Python'?
I need something like this getBrowseNodeId('Python') to get the correct and updated BrowseNodeId to avoid the error posted over.
Any advice or workflow that I can follow?
Thanks in advance.
Best regards.
Amazon does seem to change the Ids every so often. The recommended way is to take a product and go through its associated BrowseNodes.