Skip to content

Commit eb15883

Browse files
committed
👌 disable event store emits by default
1 parent 733955f commit eb15883

File tree

4 files changed

+93
-66
lines changed

4 files changed

+93
-66
lines changed

‎README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,20 @@ example with mongodb:
4444

4545
var es = require('eventstore')({
4646
type: 'mongodb',
47-
host: 'localhost', // optional
48-
port: 27017, // optional
49-
dbName: 'eventstore', // optional
50-
eventsCollectionName: 'events', // optional
51-
snapshotsCollectionName: 'snapshots', // optional
52-
transactionsCollectionName: 'transactions', // optional
53-
timeout: 10000 // optional
47+
host: 'localhost', // optional
48+
port: 27017, // optional
49+
dbName: 'eventstore', // optional
50+
eventsCollectionName: 'events', // optional
51+
snapshotsCollectionName: 'snapshots', // optional
52+
transactionsCollectionName: 'transactions', // optional
53+
timeout: 10000, // optional
54+
emitStoreEvents: true // optional, by default no store events are emitted
5455
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
55-
// authSource: 'authedicationDatabase', // optional
56-
// username: 'technicalDbUser', // optional
56+
// authSource: 'authedicationDatabase' // optional
57+
// username: 'technicalDbUser' // optional
5758
// password: 'secret' // optional
5859
// url: 'mongodb://user:pass@host:port/db?opts // optional
59-
// positionsCollectionName: 'positions' // optioanl, defaultly wont keep position
60+
// positionsCollectionName: 'positions' // optional, defaultly wont keep position
6061
});
6162

6263
example with redis:
@@ -69,9 +70,10 @@ example with redis:
6970
prefix: 'eventstore', // optional
7071
eventsCollectionName: 'events', // optional
7172
snapshotsCollectionName: 'snapshots', // optional
73+
emitStoreEvents: true, // optional, by default no store events are emitted
7274
timeout: 10000 // optional
73-
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
74-
// password: 'secret' // optional
75+
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
76+
// password: 'secret' // optional
7577
});
7678

7779
example with tingodb:
@@ -82,8 +84,9 @@ example with tingodb:
8284
eventsCollectionName: 'events', // optional
8385
snapshotsCollectionName: 'snapshots', // optional
8486
transactionsCollectionName: 'transactions', // optional
85-
timeout: 10000 // optional
86-
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
87+
timeout: 10000, // optional
88+
emitStoreEvents: true // optional, by default no store events are emitted
89+
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
8790
});
8891

8992
example with elasticsearch:
@@ -95,8 +98,9 @@ example with elasticsearch:
9598
eventsTypeName: 'events', // optional
9699
snapshotsTypeName: 'snapshots', // optional
97100
log: 'warning', // optional
98-
maxSearchResults: 10000 // optional
99-
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
101+
maxSearchResults: 10000, // optional
102+
emitStoreEvents: true // optional, by default no store events are emitted
103+
// maxSnapshotsCount: 3 // optional, defaultly will keep all snapshots
100104
});
101105

102106
example with custom elasticsearch client (e.g. with AWS ElasticSearch client. Note ``` http-aws-es ``` package usage in this example):
@@ -130,9 +134,10 @@ example with azuretable:
130134
storageAccount: 'nodeeventstore',
131135
storageAccessKey: 'aXJaod96t980AbNwG9Vh6T3ewPQnvMWAn289Wft9RTv+heXQBxLsY3Z4w66CI7NN12+1HUnHM8S3sUbcI5zctg==',
132136
storageTableHost: 'https://nodeeventstore.table.core.windows.net/',
133-
eventsTableName: 'events', // optional
134-
snapshotsTableName: 'snapshots', // optional
135-
timeout: 10000 // optional
137+
eventsTableName: 'events', // optional
138+
snapshotsTableName: 'snapshots', // optional
139+
timeout: 10000, // optional
140+
emitStoreEvents: true // optional, by default no store events are emitted
136141
});
137142

138143
example with dynamodb:
@@ -150,7 +155,8 @@ example with dynamodb:
150155
UndispatchedEventsReadCapacityUnits: 1, // optional
151156
useUndispatchedEventsTable: true // optional
152157
eventsTableStreamEnabled: false // optional
153-
eventsTableStreamViewType: 'NEW_IMAGE' // optional
158+
eventsTableStreamViewType: 'NEW_IMAGE', // optional
159+
emitStoreEvents: true // optional, by default no store events are emitted
154160
});
155161

156162
DynamoDB credentials are obtained by eventstore either from environment vars or credentials file. For setup see [AWS Javascript SDK](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html).

‎index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ module.exports = function(options) {
7272

7373
var eventstore = new Eventstore(options, new Store(options));
7474

75-
var storeEventEmitter = new StoreEventEmitter(eventstore);
76-
storeEventEmitter.addEventEmitter();
75+
if (options.emitStoreEvents) {
76+
var storeEventEmitter = new StoreEventEmitter(eventstore);
77+
storeEventEmitter.addEventEmitter();
78+
}
7779

7880
return eventstore;
7981
};

‎lib/storeEventEmitter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var _ = require('lodash');
2-
var uuid = require('uuid').v4;
32
var Eventstore = require('./eventstore');
43

54
/**
@@ -285,5 +284,4 @@ function StoreEventEmitter(eventstore) {
285284
};
286285
}
287286

288-
289287
module.exports = StoreEventEmitter;

0 commit comments

Comments
 (0)