cancel
Showing results for 
Search instead for 
Did you mean: 

Query to get all the MessageStartEvent the Engine is listening to

sorinello
Champ in-the-making
Champ in-the-making
Hello,

I have several processes deployed each having a unique MessageStartEvent start node.

I need to map these Messages to certain Events thrown by my system. So for example I want to start a certain process when a document is created. I DON'T want to hardcode this, I need a way to configure this from UI (by the Admin). In order to be able to do this, I'd like to have a list of all processes and their corresponding MessageStartEvent messages.

Here is an example:
Process1 - MessageStartEvent: startWhenAdminPageModified - Listen for Updated Document Event [Editable by admin]
Process2 - MessageStartEvent: startWhenUserRequestsAssistance - Listen for Created Document Event [Editable by admin]
Process3 - MessageStartEvent: startWhenUserDisablesHisAccount - Listen for Deleted Document Event [Editable by admin]

I want the Admin to be able to change, from the UI, which listener should be assigned to each Activiti Message.

Is there any API to be able to get the list of processes and their MessageStartEvent message Id ? I only see "messageEventSubscriptionName(String messageName)" , and that does not help.

Regards,
Sorin B.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
It doesn't seem you actually need message start events, or at least I see very little value using it that way. Why don't you have your own (very simple) mapping from events -> process definition? That way you can easily make a UI on top of it.

sorinello
Champ in-the-making
Champ in-the-making
Ok, so from what you wrote I understand that you're suggesting I crerate a simple mapping events -> process definition and in the mapping I should have something like:

On Created Document Event -> start the following process instances: Process1, Process3
On Deleted Document Event -> start the following process instances: Process5, and so on

So in the code it would be an iteration on some sort of structure (let's say a Map) and for each process mapped I should use startProcessInstanceBy[Key, Id, etc]… without the need of MessateStartEvents. Did I understood properly ?

If this is your suggestion, I am wondering, what is the primary use case for MessageStartEvent ?

Regards,
Sorin B.

jbarrez
Star Contributor
Star Contributor
Yes, that is indeed what I meant. But you can definitely still use message start events if you want to. However, I see little added value of using a message start event vs just having a mapping to process definition keys. Certainly if you need a dynamic UI like the one you describe: having a query on the message start events would still require you to write a mapping to those specific messages.