cancel
Showing results for 
Search instead for 
Did you mean: 

Start a process instance using Signal instead of Message

sorinello
Champ in-the-making
Champ in-the-making
Hello,
I am developing a new feature for our product which involves starting a process instance when something in the system (product) happens. So this is an external trigger from Activiti point of view.

I have read the User Guide, and also found some hints in the forum.

After trying to understand, i have some questions:

I see that there is a MessageStartEvent which allows a process to be started when the Activiti Engine receives a message. I am able to start my process when calling
getProcessEngine().getRuntimeService().startProcessInstanceByMessage('autoStart')


Also querying the Engine to see which process instance is "listening" to that _unique_ message, I get my process returned, so everything if OK until now
getProcessEngine().getRepositoryService().createProcessDefinitionQuery().messageEventSubscription("autoStart").singleResult()


In the documentation is stated that:
The name of the message start event must be unique across all deployed process definitions. Activiti throws an exception upon deployment of a process definition such that one or more message start events reference a message with the same name as a message start event already deployed by a different process definition. 

I want to do the same, but instead using Messages (which have to be unique across all deployments within the engine) I'd like to use Events. One of my usecases would be that I want to start several different processes when the engine receives a message (the same message).

I don't see any start node which listens for an Event, so I am stuck here.
I also see that querying for registered Signals is done using RuntimeService, and for querying listening Messages the RepositoryService is used.

Any hints or clarifications would be very helpful.

Regards,
Sorin B.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Why can't you simply have some queue for those events and call the startProcessInstanceByMessage accordingly?

Or am I not understanding your use case correct?

sorinello
Champ in-the-making
Champ in-the-making
This might be the case, but i wanted to know exactly the diference between Messages and Signals before making a decision.

Messages are sent to the Engine which starts the proces intances and Signals are _only_ for already running proceses ?

Am I understanding properly ?

frederikherema1
Star Contributor
Star Contributor
Yes, that's how it is currently implemented in Activiti.