Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the collaboration.js example #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,13 @@ These processes must be created together:

The collaboration of the processes is then implemented in the handlers. For example, it is possible to get a partner process by name and then send an event to this process. This is frequently done to start the partner process:

exports.Task_2 = function(data, done) {
// after arriving ot "Task 2" we start process 1
var partnerProcess = this.getParticipantByName("My First Process");
partnerProcess.triggerEvent("Start Event 1");
done(data);
};
exports.Task_2 = function(data, done) {
// after arriving ot "Task 2" we start process 1
this.getParticipantByName("My First Process", function(err, partnerProcess) {
partnerProcess.triggerEvent("Start Event 1");
done(data);
});
};

However, another option is to get all outgoing message flows and send a message along these flows. In the current example we have exactly one flow, so sending the message is done by:

Expand Down
8 changes: 4 additions & 4 deletions examples/processes/collaboration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

exports.Task_2 = function( data , done ){
// after arriving ot "Task 2" we start process 1
var partnerProcess = this.getParticipantByName("My First Process");
partnerProcess.triggerEvent("Start Event 1");
done(data);
done();
this.getParticipantByName("My First Process", function(err, partnerProcess) {
partnerProcess.triggerEvent("Start Event 1");
done(data);
});
};


Expand Down