Skip to content

Commit

Permalink
fixed sagahandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriano Raiano committed Feb 20, 2013
1 parent e01651e commit 1c79f41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/bases/sagaHandlerBase.js
Expand Up @@ -12,7 +12,7 @@ SagaHandler.prototype = {
var self = this;

function initSaga(id, data) {
var saga = new this.Saga(id);
var saga = new self.Saga(id);
saga.load(data);
self.sagas[id] = saga;
}
Expand All @@ -21,7 +21,7 @@ SagaHandler.prototype = {
if (!err) {
for(var i = 0, len = sagas.length; i < len; i++) {
var saga = sagas[i];
initSaga(stream.id, saga);
initSaga(saga.id, saga);
}
}
});
Expand Down Expand Up @@ -62,6 +62,7 @@ SagaHandler.prototype = {
commit: function(saga, callback) {
var self = this;
this.repository.get(saga.id, function(err, vm) {
vm.set('type', self.saga);
if (saga.get('destroyed')) {
vm.destroy();
} else {
Expand Down
3 changes: 3 additions & 0 deletions lib/domain.js
Expand Up @@ -69,6 +69,9 @@ module.exports = domain = _.extend(new EventEmitter2({

_.defaults(options, defaults);

options.commandQueue.collectionName = options.commandQueue.collectionName || defaults.commandQueue.collectionName;
options.repository.collectionName = options.repository.collectionName || defaults.repository.collectionName;

// initialize the hub by passing the function that gets the command id from the event
hub.init(newGetCommandId || getCommandId);

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"author": "adrai",
"name": "cqrs-domain",
"version": "0.3.5",
"version": "0.3.6",
"private": false,
"main": "index.js",
"engines": {
Expand Down

0 comments on commit 1c79f41

Please sign in to comment.