I’m trying to model a process dealing with hierarchical data.
The customer should be notified about events (past or upcoming). We should be able to prepare and deliver several messages about one event: first we start with a single initial message, but eventually, more messages can be added, like follow-ups and conclusion messages. Every message has its own workflow - it can be updated, scheduled for delivery, in delivery, delivered. The workflow of event is tied to the state of its messages: for example it is closed when all its messages are delivered and event end time has passed without anyone adding new messages.
So, my main entity is Event. It has own data attributes like customers, summary, start and end times. This data is common to all this events’ messages. So I model a single Event as a process instance. But individual messages have their own, independent and possibly different paths though the delivery workflow. So, I thought it is natural to have them as “executions” or “tokens”.
Well, there are multiple messages for one event. I could create a multivalued or list variable to store them. The problem is - when a workflow token of a message reaches some Activity - how do I know -which message was that? It may be multiple messages at the same Activity - how do I know - which one just arrived and should be dealt with?
I also tried to store them as local vars. The problem is - local vars are scoped to the current activity, whatever that means. They will not survive though the whole path of the token.
I cannot find a way to get the data that travels with that token. A regular variable just has the common data for all tokens of current process instance - nothing specific to the token at hand.
I also thought about using multiinstance subprocesses. They should deal nicely with local vars (not sure if they are local, but, as I understand, each subprocess instance gets its own). The problem is that in our case we do not have all the messages at once. A new message may be created at any time. So, we never have a final iterable list of messages, which, as I understand, is required to create a multiinstance subprocess.