Coder Social home page Coder Social logo

node-eventstore-client's People

Contributors

cdimitroulas avatar jdextraze avatar jurjean avatar jwulf avatar majorbreakfast avatar maniolias avatar nicdex avatar paullucas avatar poimen avatar robertreppel avatar schostin avatar sledorze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-eventstore-client's Issues

TcpEndpoint.hostname -> .host == Ouch!

I upgraded to 0.0.25 and discovered, the hard way, that 'hostname' had been changed to 'host'.

it would be nicer to log a warning of the name change for a few releases.

Hard deleted stream events are emitted with subscribeToAllFrom

If you hard delete a stream using something like:

await this.connection.deleteStream(streamName, sequence, true, credentials)

When you use subscribeToAllFrom, the streams are deleted, but the events are still returned by the iteration callback.

I have checked the metadata for the stream in the callback and it shows up as deleted and you cannot view the stream in the admin UI so there is probably a bug.

Handle Large events

I am having an issue with handling events the have large size (> 3mb)

There a few such events on some of the streams in the eventstore I am using. According to this issue (issue: 899) on the EventStore repo the largest size allowed is 16mb although it is recommended to have have events smaller than 2mb.

When attempting to read the the event there is connection retry limit exceed error thrown shown below:

Error: Retry limit reached. Operation: Operation ReadStreamEventsForwardOperation (5fc60d08-a0d9-47a3-9fb2-d229a5e5de84): Stream: Meter-88912334, FromEventNumber: 11510, MaxCount: 10, ResolveLinkTos: true, RequireMaster: true, retry count: 10, created: 08:01:01.488, last updated: 08:01:46.648, RetryCount: 10

I wrote a test to replicate the issue in this pull request Large Events Test. The append test fails with a different exception shown below:

Error: Bad request: Could not unwrap network package for command WriteEvents.

at AppendToStreamOperation.OperationBase._inspectBadRequest (/mnt/c/projects/rjmarshall/eventstore-node/src/clientOperations/operationBase.js:104:13)
at AppendToStreamOperation.OperationBase.inspectPackage (/mnt/c/projects/rjmarshall/eventstore-node/src/clientOperations/operationBase.js:74:21)
at EventStoreConnectionLogicHandler._handleTcpPackage (/mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:501:38)
at /mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:92:10
at Immediate._handlers.(anonymous function) (/mnt/c/projects/rjmarshall/eventstore-node/src/core/simpleQueuedHandler.js:19:7)
at runCallback (timers.js:653:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)

Subscription dropped

Any idea why do I get this ? it's happening when I connect my local application to aws evetstore

2018-07-06T16:44:25.901Z Subscription dropped: catchUpError Error: Retry limit reached. Operation: Operation ReadAllEventsForwardOperation (1db424ae-311f-410c-970f-069e7eccf422): Position: {"commitPosition":{"low":0,"high":0,"unsigned":false},"preparePosition":{"low":0,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: false, RequireMaster: true, retry count: 10, created: 16:43:46.794, last updated: 16:44:22.706, RetryCount: 10
    at OperationsManager.module.exports.OperationsManager.scheduleOperationRetry (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4319:30)
    at /Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4285:10
    at Array.forEach (<anonymous>)
    at OperationsManager.module.exports.OperationsManager.checkTimeoutsAndRetry (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4284:19)
    at EventStoreConnectionLogicHandler.module.exports.EventStoreConnectionLogicHandler._goToConnectedState (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3422:22)
    at EventStoreConnectionLogicHandler.module.exports.EventStoreConnectionLogicHandler._handleTcpPackage (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3525:12)
    at /Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3095:10
    at Immediate._handlers.(anonymous function) (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3749:7)
    at runCallback (timers.js:764:11)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
internal/process/warning.js:18 (node:55019) UnhandledPromiseRejectionWarning: Error: Retry limit reached. Operation: Operation ReadAllEventsForwardOperation (1db424ae-311f-410c-970f-069e7eccf422): Position: {"commitPosition":{"low":0,"high":0,"unsigned":false},"preparePosition":{"low":0,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: false, RequireMaster: true, retry count: 10, created: 16:43:46.794, last updated: 16:44:22.706, RetryCount: 10
    at OperationsManager.module.exports.OperationsManager.scheduleOperationRetry (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4319:30)
    at /Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4285:10
    at Array.forEach (<anonymous>)
    at OperationsManager.module.exports.OperationsManager.checkTimeoutsAndRetry (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:4284:19)
    at EventStoreConnectionLogicHandler.module.exports.EventStoreConnectionLogicHandler._goToConnectedState (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3422:22)
    at EventStoreConnectionLogicHandler.module.exports.EventStoreConnectionLogicHandler._handleTcpPackage (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3525:12)
    at /Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3095:10
    at Immediate._handlers.(anonymous function) (/Users/amirb/source/krs-oc-sync/node_modules/node-eventstore-client/lib/dist.js:3749:7)
    at runCallback (timers.js:764:11)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)

Optional fields in TypeScript definitions

ResolvedEvent interface has optional event and originalEvent, but looking at the code and Protobuf messages it seems these fields are always present.

Please correct me if I'm wrong. This leads to a problem when using TypeScript with strictNullChecks in which case the compiler doesn't let you access subfields unless you first check that the field value is not null or undefined.

UUID endian issue

The eventid seems to get endian-swapped (or rather, it doesn't) on the way in & out of the eventstore.

%> node test.js

Appending...
Connected to eventstore at 172.18.0.5:1113
Stored event: 7dffd71b-c177-49ae-89ae-46a5998533d0
Look for it at: http://localhost:2113/web/index.html#/streams/testStream

%> curl -i -H "Accept: application/json" 'http://localhost:2113/streams/testStream/head/backward/1?embed=body'

{
  "title": "Event stream 'testStream'",
  "id": "http://localhost:2113/streams/testStream",
  "updated": "2017-08-31T13:21:11.807372Z",
  "streamId": "testStream",
  "author": {
    "name": "EventStore"
  },
  "headOfStream": true,
  "selfUrl": "http://localhost:2113/streams/testStream",
  "eTag": "9;-2060438500",
  "links": [
    {
      "uri": "http://localhost:2113/streams/testStream",
      "relation": "self"
    },
    {
      "uri": "http://localhost:2113/streams/testStream/head/backward/1",
      "relation": "first"
    },
    {
      "uri": "http://localhost:2113/streams/testStream/0/forward/1",
      "relation": "last"
    },
    {
      "uri": "http://localhost:2113/streams/testStream/8/backward/1",
      "relation": "next"
    },
    {
      "uri": "http://localhost:2113/streams/testStream/10/forward/1",
      "relation": "previous"
    },
    {
      "uri": "http://localhost:2113/streams/testStream/metadata",
      "relation": "metadata"
    }
  ],
  "entries": [
    {
      "eventId": "1bd7ff7d-77c1-ae49-89ae-46a5998533d0",
      "eventType": "testEvent",
      "eventNumber": 9,
      "data": "{\"a\":0.04060175919930331,\"b\":\"7bfe63f0-4529-4c61-8cc6-594fcca47720\"}",
      "streamId": "testStream",
      "isJson": true,
      "isMetaData": false,
      "isLinkMetaData": false,
      "positionEventNumber": 9,
      "positionStreamId": "testStream",
      "title": "9@testStream",
      "id": "http://localhost:2113/streams/testStream/9",
      "updated": "2017-08-31T13:21:11.807372Z",
      "author": {
        "name": "EventStore"
      },
      "summary": "testEvent",
      "links": [
        {
          "uri": "http://localhost:2113/streams/testStream/9",
          "relation": "edit"
        },
        {
          "uri": "http://localhost:2113/streams/testStream/9",
          "relation": "alternate"
        }
      ]
    }
  ]
}

eventid allegedly sent by node-evenstore-client:
7dffd71b-c177-49ae-89ae-46a5998533d0
eventid when using the http interface:
1bd7ff7d-77c1-ae49-89ae-46a5998533d0

The uuid-parse module, which node-eventstore-client depends on, also seem to have had this issue raised: https://github.com/zefferus/uuid-parse/issues/2

However, it looks like development of that module has stopped, or at least has very little traction. I'm not sure if there are other uuid modules, that supports different endian modes, but alternatively here's a little hacked version of uuid-parse.js:

'use strict';

// Maps for number <-> hex string conversion
var _byteToHex = [];
var _hexToByte = {};
for (var i = 0; i < 256; i++) {
  _byteToHex[i] = (i + 0x100).toString(16).substr(1);
  _hexToByte[_byteToHex[i]] = i;
}

// **`parse()` - Parse a UUID into it's component bytes**
function parse(s, buf, offset) {
  const i = (buf && offset) || 0;
  offset = i;
  let ii = 0;

  buf = buf || Buffer.alloc(16 + i);
  s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
    if (ii < 16) { // Don't overflow!
      buf[i + ii++] = _hexToByte[oct];
    }
  });

  // Zero out remaining bytes if string was short
  while (ii < 16) {
    buf[i + ii++] = 0;
  }

  // Endian-swap hack...
  var buf2 = Buffer.from(buf);
  buf[offset+0] = buf2[offset+3];
  buf[offset+1] = buf2[offset+2];
  buf[offset+2] = buf2[offset+1];
  buf[offset+3] = buf2[offset+0];
  buf[offset+4] = buf2[offset+5];
  buf[offset+5] = buf2[offset+4];
  buf[offset+6] = buf2[offset+7];
  buf[offset+7] = buf2[offset+6];
  
  return buf;
}

// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
function unparse(buf, offset) {
  let i = offset || 0;

  // Endian-swap hack...
  var buf2 = Buffer.from(buf);
  buf[i+0] = buf2[i+3];
  buf[i+1] = buf2[i+2];
  buf[i+2] = buf2[i+1];
  buf[i+3] = buf2[i+0];
  buf[i+4] = buf2[i+5];
  buf[i+5] = buf2[i+4];
  buf[i+6] = buf2[i+7];
  buf[i+7] = buf2[i+6];

  const bth = _byteToHex;
  return  bth[buf[i++]] + bth[buf[i++]] +
          bth[buf[i++]] + bth[buf[i++]] + '-' +
          bth[buf[i++]] + bth[buf[i++]] + '-' +
          bth[buf[i++]] + bth[buf[i++]] + '-' +
          bth[buf[i++]] + bth[buf[i++]] + '-' +
          bth[buf[i++]] + bth[buf[i++]] +
          bth[buf[i++]] + bth[buf[i++]] +
          bth[buf[i++]] + bth[buf[i++]];
}

module.exports = {
  parse,
  unparse
};

docs are down

Hi, first thank you for this work, I am using it and appreciate it.
second, the link to your docs is down.
third, did you change the name? npm has it as node-eventstore but yoru repo seems to be node-eventstore-client and the readme says to install it via node-eventstore-client.
maybe it's always been this way, I can't remember.
thanks,
R

`subscribeToStreamFrom` should accept null

The TypeScript definition looks like this:

subscribeToStreamFrom(stream: string, lastCheckpoint: Long|number|null, resolveLinkTos: boolean, eventAppeared: EventAppearedCallback<EventStoreCatchUpSubscription>, liveProcessingStarted?: LiveProcessingStartedCallback, subscriptionDropped?: SubscriptionDroppedCallback<EventStoreCatchUpSubscription>, userCredentials?: UserCredentials, readBatchSize?: number): EventStoreCatchUpSubscription;

But passing null as the lastCheckpoint results in an error.

 TypeError: eventNumber should be a Long|number.
        at Object.module.exports.module.exports.isLongOrInteger (/Users/me/demo-service/node_modules/node-eventstore-client/lib/dist.js:683:11)
        at EventStoreNodeConnection.module.exports.EventStoreNodeConnection.readEvent (/Users/me/demo-service/node_modules/node-eventstore-client/lib/dist.js:2543:10)
        at EventStoreStreamCatchUpSubscription.eventAppeared [as _eventAppeared] (/Users/me/demo-service/node_modules/@velocityapp/src/event-store.service.ts:422:41)
        at EventStoreStreamCatchUpSubscription.module.exports.EventStoreStreamCatchUpSubscription._tryProcess (/Users/me/demo-service/node_modules/node-eventstore-client/lib/dist.js:5933:20)
        at processEvents (/Users/me/demo-service/node_modules/node-eventstore-client/lib/dist.js:5885:17)
        at /Users/me/demo-service/node_modules/node-eventstore-client/lib/dist.js:5896:22

Workaround:

if (eventNumber == null) {
  eventNumber = Long.ZERO
}

subscribeToAllFrom from stored serialized Position

I would like to store the last currentPosition serialized in Redis so if my processes crashes it can pick up where it left off, however subscribeToAllFrom takes an instance of Position and there is no direct way to resume at a serialized position because the Position class is not available in the main exported package.

I did manage a work around by importing directly from the src folder instead of the main package but it would be nice to be able to import Position directly from the package.

This is my work around

import esClient from 'eventstore-node/src/client';
import { Position } from 'eventstore-node/src/results';

...
conn.subscribeToAllFrom(new Position(60697923, 60697923), ...);

But ideally I would like to do this.

import esClient, { Position } from 'eventstore-node';

...
conn.subscribeToAllFrom(new Position(60697923, 60697923), ...);

appendToStream with a large number of events

When appending a large number of events to a stream.

Pull request with an append to stream test

The connection retry limit is exceeded:

_Error: Expected 2 assertions, 0 ran
at done (/mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/lib/types.js:121:25)
at /mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/lib/core.js:219:25
at /mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/deps/async.js:168:13
at /mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/deps/async.js:131:25
at /mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/deps/async.js:165:17
at /mnt/c/projects/rjmarshall/eventstore-node/node_modules/nodeunit/deps/async.js:463:34
at EventStoreNodeConnection. (/mnt/c/projects/rjmarshall/eventstore-node/test/common/base_test.js:48:5)
at emitOne (events.js:101:20)
at EventStoreNodeConnection.emit (events.js:189:7)
at EventStoreConnectionLogicHandler. (/mnt/c/projects/rjmarshall/eventstore-node/src/eventStoreNodeConnection.js:57:10)
at emitOne (events.js:96:13)
at EventStoreConnectionLogicHandler.emit (events.js:189:7)
at EventStoreConnectionLogicHandler._closeConnection (/mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:188:8)
at /mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:66:10
at Immediate._handlers.(anonymous function) (/mnt/c/projects/rjmarshall/eventstore-node/src/core/simpleQueuedHandler.js:19:7)
at runCallback (timers.js:653:20)

Error: Retry limit reached. Operation: Operation AppendToStreamOperation (dba851f9-721e-4f70-a3fe-29616a70b705): Stream: test-0c952655-8ee4-4bea-9db7-b63f16582676, ExpectedVersion: -2, retry count: 10, created: 08:09:27.525, last updated: 08:09:53.444, RetryCount: 10
at OperationsManager.scheduleOperationRetry (/mnt/c/projects/rjmarshall/eventstore-node/src/core/operationsManager.js:120:30)
at /mnt/c/projects/rjmarshall/eventstore-node/src/core/operationsManager.js:86:10
at Array.forEach (native)
at OperationsManager.checkTimeoutsAndRetry (/mnt/c/projects/rjmarshall/eventstore-node/src/core/operationsManager.js:85:19)
at EventStoreConnectionLogicHandler._timerTick (/mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:614:26)
at /mnt/c/projects/rjmarshall/eventstore-node/src/core/eventStoreConnectionLogicHandler.js:96:10
at Immediate._handlers.(anonymous function) (/mnt/c/projects/rjmarshall/eventstore-node/src/core/simpleQueuedHandler.js:19:7)
at runCallback (timers.js:653:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as immediateCallback] (timers.js:596:5)

UserCredentials function on Client does nothing

Passing user credentials to the Client using the UserCredentials function (see here) does not seem to have any effect.

I would have expected this to pass some default credentials for all future calls like appendToStream but it seems that is not the case.

  1. If I have misunderstood, could you please explain what is the purpose of this function?
  2. Can we come up with an implementation which makes sense for this to work as it can be cumbersome to have to pass credentials on each individual call

Connection complains that an operation never got a response from the server, but that operation has completed.

2016-12-07T01:09:37.881Z ERROR EventStoreConnection 'ES-cf60d3c7-e0ae-4708-b6af-7bbd916adfaa': operation never got response from server.
UTC now: Tue Dec 06 2016 17:09:37 GMT-0800 (PST), operation: Operation ReadAllEventsForwardOperation (d1f4ec10-1881-45c6-b3e4-e02ab21d8ea1): Position: {"commitPosition":{"low":0,"high":0,"unsigned":false},"preparePosition":{"low":0,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: true, RequireMaster: true, retry count: 0, created: 01:09:30.807, last updated: 01:09:30.807.
2016-12-07T01:09:39.083Z ERROR EventStoreConnection 'ES-cf60d3c7-e0ae-4708-b6af-7bbd916adfaa': operation never got response from server.
UTC now: Tue Dec 06 2016 17:09:39 GMT-0800 (PST), operation: Operation ReadAllEventsForwardOperation (81ffc0e3-abff-40cc-9e90-69ce226ea152): Position: {"commitPosition":{"low":6956370,"high":0,"unsigned":false},"preparePosition":{"low":6956370,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: true, RequireMaster: true, retry count: 0, created: 01:09:31.069, last updated: 01:09:31.070.
2016-12-07T01:09:39.083Z ERROR EventStoreConnection 'ES-cf60d3c7-e0ae-4708-b6af-7bbd916adfaa': operation never got response from server.
UTC now: Tue Dec 06 2016 17:09:39 GMT-0800 (PST), operation: Operation ReadAllEventsForwardOperation (6ae447ea-38c6-4467-8455-e0d376712f80): Position: {"commitPosition":{"low":9731718,"high":0,"unsigned":false},"preparePosition":{"low":9731718,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: true, RequireMaster: true, retry count: 0, created: 01:09:31.169, last updated: 01:09:31.169.
2016-12-07T01:09:39.084Z ERROR EventStoreConnection 'ES-cf60d3c7-e0ae-4708-b6af-7bbd916adfaa': operation never got response from server.

Error: Package size is out of bounds

I am getting the following error:

[ERROR] Error: Package size is out of bounds: 91150338(max: 67108864

This happens while establishing a connection.

Is there a way I can configure maximal package size?

strange reconnect error

Hi,
I have an end to end test. First it kills the ES instance and restarts it so it's a clean instance.
So sometimes it reconnects and my handlers all say 'Caught up with previously stored events. Listening for new events.' And all is good, sometimes I get to that point and it doesn't pick up an new events form ES.
The sequence is as follows

good case:

  1. TcpPackageConnection: connection [{"host":"172.18.0.2","port":1113}, L{"host":"172.18.0.4","port":39716}, d5ae7be2-d5c2-47d1-b590-cbac22cfdb5f] was closed with error: Error: transmission error.. |
  2. Subscription dropped.
  3. Error: Connection was closed
  4. TcpPackageConnection: connection to ...blah... ECOONREFUSED
  5. TcpPackageConnection: connected to ...blah (success)
  6. Caught up with previously stored events. Listening for new events.

bad case:

  1. TcpPackageConnection: connection [{"host":"172.18.0.2","port":1113}, L{"host":"172.18.0.4","port":39716}, d5ae7be2-d5c2-47d1-b590-cbac22cfdb5f] was closed with error: Error: transmission error.. |
    ***No Subscription dropped. or Error: Connection was closed ***
  2. TcpPackageConnection: connection to ...blah... ECOONREFUSED
  3. TcpPackageConnection: connected to ...blah (success)
  4. EventStoreConnection 'ES-87aa65ee-065c-4a97-a551-9cad38c8c046': operation never got response from server.
    UTC now: Sun Oct 14 2018 17:35:25 GMT+0000 (Coordinated Universal Time), operation: Operation ReadAllEventsForwardOperation (dc12a6a4-6173-423a-a7c6-5bc51b738be9): Position: {"commitPosition":{"low":### 171680,"high":0,"unsigned":false},"preparePosition":{"low":0,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: false, RequireMaster: true, retry count: 0, created: 17:35:18.153, last updated: 17:35:18.153. | 5:35:25 pm
  5. Caught up with previously stored events. Listening for new events.
    and then just hangs.

So in the bad case the subscriptions don't drop, and I get an error trying to connect with a commit position that is way higher than the latest event. I don't know where it's getting that number from but it's always the same and I believe it's the culprit.
Does this make any sense to you? I can't figure out what the heck is happening.
Thanks,
Raif

PersistentSubscriptionNakEventAction is not exported

const {
  PersistentSubscriptionNakEventAction,
  PersistentSubscriptionSettings
} = require('node-eventstore-client')

PersistentSubscriptionSettings is defined while PersistentSubscriptionNakEventAction is undefined

It looks like the class is not exported. Would be great to have this enum to work with.

Exception when retrieving RecordedEvents

I got a TypeError: ev.createdEpoch.toNumber is not a function
from here:

this.created = new Date(ev.createdEpoch ? ev.createdEpoch.toNumber() : 0);

Inspecting the value reveals,createdEpoch is a number hence the crash.

I'm wondering if I'm doing something wrong because how simple I made it crash.
What type was it supposed to be?

Scavenge method

I would like to be able to run scavenge after hard deleting streams when automating unit tests so the streams are fully removed.

SubscribeToAllStreamFrom doesn't pick up first event

After reading all events from the store to rebuild local projections, I start subscribing to the $all stream starting at the nextPosition provided by my last call to readAllEventsForward.

In some cases the first event that is published to the event store doesn't show in eventAppeared.
I do eventually receive a $statsCollected.

originalPosition

Hi, my events seem to be coming over with originalPosition set to null. I put a log inside of the eventstore-node code and that is what's comming into the liveQueue ( I think that's what it was ). there is an event number, but the originalPosition is comprised of two numbers, the event number and whatever the number is after a garbage collection. It seems like your system knows about it because it's got a property for it but it's null.
I can keep digging and try and find out more, but if you know anything about this that would be great.
Thanks,
r

CHANGELOG

In response to issue #21, I've decided to create this thread to track changes between released version of the npm package.
Make sure you subscribe to this issue if you want to be notified of changes in the API.

Projections

There no visible API for projections in this Client.
I'm wondering if that could be added or if it should be out of scope for that project (and why).

ReferenceError on connection drop

ERROR: ReferenceError: connectionId is not defined
at /home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:3111:69
at Hash.forEach (/home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:3046:6)
at SubscriptionsManager.purgeSubscribedAndDroppedSubscriptions (/home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:3110:30)
at EventStoreConnectionLogicHandler._tcpConnectionClosed (/home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:1913:24)
at /home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:1565:11
at Immediate._handlers.(anonymous function) (/home/nicolas/dev/adaptech/sturgeon/node_modules/eventstore-node/lib/dist.js:2176:8)
at Immediate.immediate._onImmediate (timers.js:435:18)
at processImmediate [as _immediateCallback] (timers.js:383:17)

Can't find `Position`

I just updated to 0.0.25 and now I'm getting this error in tsc:

node_modules/eventstore-node/index.d.ts(10,18): error TS2304: Cannot find name 'Position'.

Typescript 2.1.5

If I add an exported Position class in index.d.ts everything is fine.

How to stop a CatchUpSubscription

Thanks for putting effort in porting the client over to Node.js land! I have one question though :)

Can you point me into the right direction when it comes to stopping a CatchUpSubscription? I want to read all events from a particular stream and pushing it into an RxJS Observable. When the stream reaches the "Live Subscription mark", I want to stop it. I tried the following, but it doesn't work as expected:

Observable
    .create((observer) => {
        let streamer;

        const onSubscriptionDropped = (subscription, reason, err) =>
            observer.error(new Error(err));

        const onLiveSubscription = () => {
            streamer.stop();

            observer.complete();
        };

        const onEvent = (stream, resolvedEvent) => {
            const event = resolvedEvent.originalEvent;
            const { data, isJson } = event;

            observer.next(
                Object.assign({}, event, {
                    data: isJson ? JSON.parse(data.toString()) : data
                })
            );
        };

        streamer = connection.subscribeToStreamFrom(
            streamName,
            0,
            true,
            onEvent,
            onLiveSubscription,
            onSubscriptionDropped,
            new EventStore.UserCredentials("***", "***")
        );
    })
    .scan(reducer, {})

Executing that leads to a "never ending application" โ€“ย it seems like the subscription is still alive after all.

tslint error

Error at /Users/mbishop/Projects/cookies/node_modules/eventstore-node/index.d.ts:23:12: 'create', which lacks return-type annotation, implicitly has an 'any' return type.

version 0.0.30

Problem connecting to non master node, works fine when ip is master node

works when requireMaster is false but advised by Nic that that's not how it works.

dns

nslookup eventstore-service

Name:      eventstore-service
Address 1: 10.2.69.7
Address 2: 10.2.21.8
Address 3: 10.2.54.10

client logs

2017-01-25T18:03:11.568Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55910}, 67bb90ba-fba7-4f44-8bfa-94d8259a1200].
2017-01-25T18:03:11.579Z INFO Connected to GES at { hostname: 'eventstore-service', port: 1113, host: '10.2.69.7' }
2017-01-25T18:03:11.687Z INFO App ready and listening on port 3001
2017-01-25T18:03:11.730Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55910}, 67bb90ba-fba7-4f44-8bfa-94d8259a1200] was closed cleanly.
2017-01-25T18:03:11.732Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, a41af605-22fa-4678-9460-f59c119e5008] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:11.967Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55914}, 43aca35a-6374-499b-8148-2fe47a6fc222].
2017-01-25T18:03:12.772Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55914}, 43aca35a-6374-499b-8148-2fe47a6fc222] was closed cleanly.
2017-01-25T18:03:12.773Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 8b010001-e7b9-4f34-9542-0f9fb334e085] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:12.975Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55918}, 7c588f79-4444-4806-bb30-3c5231bdce05].
2017-01-25T18:03:13.783Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55918}, 7c588f79-4444-4806-bb30-3c5231bdce05] was closed cleanly.
2017-01-25T18:03:13.783Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, db33a783-0c00-4b0f-addd-d6547f37e02b] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:13.985Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55922}, f514aec1-137a-4353-8285-2037a4106c04].
2017-01-25T18:03:14.786Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55922}, f514aec1-137a-4353-8285-2037a4106c04] was closed cleanly.
2017-01-25T18:03:14.789Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 707c9b1d-9362-4f83-a419-fa072197eb33] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:14.992Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55926}, 9a94139f-51cd-4fcd-89c4-d1e39440945e].
2017-01-25T18:03:15.794Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55926}, 9a94139f-51cd-4fcd-89c4-d1e39440945e] was closed cleanly.
2017-01-25T18:03:15.794Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 7ff04867-1530-4c10-b5c6-b816d1cbb6d5] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:15.998Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55930}, 3702b9ae-b269-44f8-90cd-d754493ad557].
2017-01-25T18:03:16.799Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55930}, 3702b9ae-b269-44f8-90cd-d754493ad557] was closed cleanly.
2017-01-25T18:03:16.800Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 63958c0d-02ea-4570-ab59-f5d0ee9a3ee0] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:17.003Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55934}, a8202bf2-c1b6-4a74-9c75-5690425b75bf].
2017-01-25T18:03:17.816Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55934}, a8202bf2-c1b6-4a74-9c75-5690425b75bf] was closed cleanly.
2017-01-25T18:03:17.816Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 8133e4b5-9b2b-4f4f-865e-caec7434a6aa] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:18.017Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55942}, f833c3b0-673e-463e-83b6-f55a34ee7b92].
2017-01-25T18:03:18.821Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55942}, f833c3b0-673e-463e-83b6-f55a34ee7b92] was closed cleanly.
2017-01-25T18:03:18.823Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, c3382bde-a35e-4196-835f-c1d761640ede] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:19.024Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55946}, 7631fddb-bc58-455b-b241-c145171618ef].
2017-01-25T18:03:19.834Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55946}, 7631fddb-bc58-455b-b241-c145171618ef] was closed cleanly.
2017-01-25T18:03:19.837Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 2c26df86-9480-4315-bb8a-b6112c0ea131] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:20.036Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55950}, 2108f8ee-4d1f-41a8-97c1-39447c4eb48e].
2017-01-25T18:03:20.842Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55950}, 2108f8ee-4d1f-41a8-97c1-39447c4eb48e] was closed cleanly.
2017-01-25T18:03:20.843Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 89ad25be-77a3-4fdb-bf6f-fb162db39bc3] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:21.043Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55954}, fd78d638-c8d7-4e31-8c33-e7f71212455b].
2017-01-25T18:03:21.846Z DEBUG TcpPackageConnection: connection [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55954}, fd78d638-c8d7-4e31-8c33-e7f71212455b] was closed cleanly.
2017-01-25T18:03:21.847Z INFO Subscription dropped. EventStoreAllCatchUpSubscription {
  _connection: 
   EventStoreNodeConnection {
     _connectionName: 'ES-447ab893-c037-4e93-adf7-86ddcf4b0a95',
     _settings: 
      { log: [Function: Logger],
        verboseLogging: false,
        maxQueueSize: 5000,
        maxConcurrentItems: 5000,
        maxRetries: 10,
        maxReconnections: 10,
        requireMaster: true,
        reconnectionDelay: 100,
        operationTimeout: 7000,
        operationTimeoutCheckPeriod: 1000,
        defaultUserCredentials: null,
        useSslConnection: false,
        targetHost: null,
        validateServer: false,
        failOnNoServerResponse: false,
        heartbeatInterval: 750,
        heartbeatTimeout: 1500,
        clientConnectionTimeout: 1000,
        clusterDns: '',
        maxDiscoverAttempts: 10,
        externalGossipPort: 0,
        gossipTimeout: 1000 },
     _clusterSettings: null,
     _endpointDiscoverer: StaticEndpointDiscoverer { _nodeEndpoints: [Object] },
     _handler: 
      EventStoreConnectionLogicHandler {
        _esConnection: [Circular],
        _settings: [Object],
        _queue: [Object],
        _state: 'connecting',
        _connectingPhase: 'connectionEstablishing',
        _endpointDiscoverer: [Object],
        _connection: [Object],
        _wasConnected: false,
        _packageNumber: 20,
        _authInfo: null,
        _lastTimeoutsTimeStamp: 1485367401845,
        _operations: [Object],
        _subscriptions: [Object],
        _timer: [Object],
        _events: [Object],
        _eventsCount: 5,
        _heartbeatInfo: [Object],
        _reconnInfo: [Object] },
     _events: {},
     _eventsCount: 0 },
  _log: [Function: Logger],
  _streamId: '',
  _resolveLinkTos: true,
  _userCredentials: UserCredentials { username: 'admin', password: 'changeit' },
  _shouldStop: false,
  _stopped: false,
  _isDropped: true,
  _subscription: null,
  _liveQueue: [],
  _dropData: null,
  _isProcessing: false,
  _eventAppeared: [Function],
  _liveProcessingStarted: [Function],
  _subscriptionDropped: [Function],
  _verbose: false,
  _onReconnect: [Function],
  _lastProcessedPosition: 
   Position {
     commitPosition: Long { low: -1, high: -1, unsigned: false },
     preparePosition: Long { low: -1, high: -1, unsigned: false } },
  _nextReadPosition: 
   Position {
     commitPosition: Long { low: 0, high: 0, unsigned: false },
     preparePosition: Long { low: 0, high: 0, unsigned: false } } } catchUpError Error: Retry limit reached. Operation: Operation ReadAllEventsForwardOperation (2efe0954-8cc6-4735-90a3-4f81496a0cd7): Position: {"commitPosition":{"low":0,"high":0,"unsigned":false},"preparePosition":{"low":0,"high":0,"unsigned":false}}, MaxCount: 500, ResolveLinkTos: true, RequireMaster: true, retry count: 10, created: 18:03:11.688, last updated: 18:03:21.844, RetryCount: 10
    at OperationsManager.scheduleOperationRetry (/usr/app/node_modules/eventstore-node/lib/dist.js:3016:31)
    at EventStoreConnectionLogicHandler._handleTcpPackage (/usr/app/node_modules/eventstore-node/lib/dist.js:2045:27)
    at /usr/app/node_modules/eventstore-node/lib/dist.js:1623:11
    at Immediate._handlers.(anonymous function) (/usr/app/node_modules/eventstore-node/lib/dist.js:2231:8)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
2017-01-25T18:03:21.851Z DEBUG TcpPackageConnection: connection to [{"host":"10.2.21.8","port":1113}, Lnull, 484917a9-7d29-4521-9ec4-8213b05797b1] failed. Error: Error: connect ECONNREFUSED 127.0.0.1:1113.
2017-01-25T18:03:22.054Z DEBUG TcpPackageConnection: connected to [{"hostname":"eventstore-service","port":1113,"host":"10.2.69.7"}, L{"host":"10.2.69.8","port":55958}, 09eeb6d2-0f7a-44dd-b41f-b0a38dbb8c2b].

eventstore logs

execing eventstored
[00001,01,18:00:45.774] 
ES VERSION:               3.9.3.0 (HEAD/f1880e43483394efb96759eab903de2f1a679f58, Wed, 30 Nov 2016 11:54:21 +0000)
OS:                       Linux (Unix 4.8.17.0)
RUNTIME:                  3.12.1 (es-mono-3.12.1/4493dfd) (64-bit)
GC:                       2 GENERATIONS
LOGS:                     /var/log/eventstore

MODIFIED OPTIONS:

	INT IP:                   10.2.69.7 (Environment Variable)
	EXT IP:                   10.2.69.7 (Environment Variable)
	INT HTTP PORT:            2113 (Environment Variable)
	EXT HTTP PORT:            2114 (Environment Variable)
	CLUSTER SIZE:             3 (Environment Variable)
	CLUSTER DNS:              eventstore-service (Environment Variable)
	CLUSTER GOSSIP PORT:      2113 (Environment Variable)
	INT HTTP PREFIXES:        http://*:2113/ (Environment Variable)
	EXT HTTP PREFIXES:        http://*:2114/ (Environment Variable)
	ADD INTERFACE PREFIXES:   false (Environment Variable)
	GOSSIP ALLOWED DIFFERENCE MS: 600000 (Environment Variable)
	RUN PROJECTIONS:          None (Config File)

DEFAULT OPTIONS:

	CONFIG:                   /etc/eventstore/eventstore.conf (<DEFAULT>)
	HELP:                     False (<DEFAULT>)
	VERSION:                  False (<DEFAULT>)
	LOG:                      /var/log/eventstore (<DEFAULT>)
	DEFINES:                  <empty> (<DEFAULT>)
	WHAT IF:                  False (<DEFAULT>)
	START STANDARD PROJECTIONS: False (<DEFAULT>)
	DISABLE HTTP CACHING:     False (<DEFAULT>)
	MONO MIN THREADPOOL SIZE: 10 (<DEFAULT>)
	INT TCP PORT:             1112 (<DEFAULT>)
	INT SECURE TCP PORT:      0 (<DEFAULT>)
	EXT TCP PORT:             1113 (<DEFAULT>)
	EXT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
	EXT SECURE TCP PORT:      0 (<DEFAULT>)
	EXT IP ADVERTISE AS:      <empty> (<DEFAULT>)
	EXT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
	EXT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
	INT IP ADVERTISE AS:      <empty> (<DEFAULT>)
	INT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
	INT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
	INT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
	INT TCP HEARTBEAT TIMEOUT: 700 (<DEFAULT>)
	EXT TCP HEARTBEAT TIMEOUT: 1000 (<DEFAULT>)
	INT TCP HEARTBEAT INTERVAL: 700 (<DEFAULT>)
	EXT TCP HEARTBEAT INTERVAL: 2000 (<DEFAULT>)
	FORCE:                    False (<DEFAULT>)
	NODE PRIORITY:            0 (<DEFAULT>)
	MIN FLUSH DELAY MS:       2 (<DEFAULT>)
	COMMIT COUNT:             -1 (<DEFAULT>)
	PREPARE COUNT:            -1 (<DEFAULT>)
	ADMIN ON EXT:             True (<DEFAULT>)
	STATS ON EXT:             True (<DEFAULT>)
	GOSSIP ON EXT:            True (<DEFAULT>)
	DISABLE SCAVENGE MERGING: False (<DEFAULT>)
	SCAVENGE HISTORY MAX AGE: 30 (<DEFAULT>)
	DISCOVER VIA DNS:         True (<DEFAULT>)
	GOSSIP SEED:              <empty> (<DEFAULT>)
	STATS PERIOD SEC:         30 (<DEFAULT>)
	CACHED CHUNKS:            -1 (<DEFAULT>)
	READER THREADS COUNT:     4 (<DEFAULT>)
	CHUNKS CACHE SIZE:        536871424 (<DEFAULT>)
	MAX MEM TABLE SIZE:       1000000 (<DEFAULT>)
	HASH COLLISION READ LIMIT: 100 (<DEFAULT>)
	DB:                       /var/lib/eventstore (<DEFAULT>)
	INDEX:                    <empty> (<DEFAULT>)
	MEM DB:                   False (<DEFAULT>)
	SKIP DB VERIFY:           False (<DEFAULT>)
	PROJECTION THREADS:       3 (<DEFAULT>)
	WORKER THREADS:           5 (<DEFAULT>)
	ENABLE TRUSTED AUTH:      False (<DEFAULT>)
	CERTIFICATE STORE LOCATION: <empty> (<DEFAULT>)
	CERTIFICATE STORE NAME:   <empty> (<DEFAULT>)
	CERTIFICATE SUBJECT NAME: <empty> (<DEFAULT>)
	CERTIFICATE THUMBPRINT:   <empty> (<DEFAULT>)
	CERTIFICATE FILE:         <empty> (<DEFAULT>)
	CERTIFICATE PASSWORD:     <empty> (<DEFAULT>)
	USE INTERNAL SSL:         False (<DEFAULT>)
	SSL TARGET HOST:          n/a (<DEFAULT>)
	SSL VALIDATE SERVER:      True (<DEFAULT>)
	AUTHENTICATION TYPE:      internal (<DEFAULT>)
	AUTHENTICATION CONFIG:    <empty> (<DEFAULT>)
	PREPARE TIMEOUT MS:       2000 (<DEFAULT>)
	COMMIT TIMEOUT MS:        2000 (<DEFAULT>)
	UNSAFE DISABLE FLUSH TO DISK: False (<DEFAULT>)
	BETTER ORDERING:          False (<DEFAULT>)
	UNSAFE IGNORE HARD DELETE: False (<DEFAULT>)
	INDEX CACHE DEPTH:        16 (<DEFAULT>)
	GOSSIP INTERVAL MS:       1000 (<DEFAULT>)
	GOSSIP TIMEOUT MS:        500 (<DEFAULT>)
	ENABLE HISTOGRAMS:        False (<DEFAULT>)
	LOG HTTP REQUESTS:        False (<DEFAULT>)
	ALWAYS KEEP SCAVENGED:    False (<DEFAULT>)

[00001,01,18:00:45.791] Quorum size set to 2
[00001,01,18:00:45.798] Cannot find plugins path: plugins
[00001,01,18:00:45.866] INSTANCE ID:              001efee8-74b4-4fd9-931e-af9460e2555f
[00001,01,18:00:45.867] DATABASE:                 /var/lib/eventstore
[00001,01,18:00:45.867] WRITER CHECKPOINT:        0 (0x0)
[00001,01,18:00:45.867] CHASER CHECKPOINT:        0 (0x0)
[00001,01,18:00:45.867] EPOCH CHECKPOINT:         -1 (0xFFFFFFFFFFFFFFFF)
[00001,01,18:00:45.868] TRUNCATE CHECKPOINT:      -1 (0xFFFFFFFFFFFFFFFF)
[00001,01,18:00:45.977] MessageHierarchy initialization took 00:00:00.0862795.
[00001,01,18:00:46.039] CACHED TFChunk #0-0 (chunk-000000.000000) in 00:00:00.0013849.
[00001,01,18:00:46.140] Starting MiniWeb for /web/es/js/projections ==> /usr/share/eventstore/projections
[00001,01,18:00:46.140] Starting MiniWeb for /web/es/js/projections/v8/Prelude ==> /usr/share/eventstore/Prelude
[00001,01,18:00:46.148] Starting MiniWeb for /web ==> /usr/share/eventstore/clusternode-web
[00001,01,18:00:46.148] Binding MiniWeb to /web/{*remaining_path}
[00001,01,18:00:46.148] Starting MiniWeb for /web ==> /usr/share/eventstore/clusternode-web
[00001,01,18:00:46.148] Binding MiniWeb to /web/{*remaining_path}
[00001,11,18:00:46.162] ========== [10.2.69.7:2113] SYSTEM INIT...
[00001,12,18:00:46.187] TableIndex initialization...
[00001,11,18:00:46.190] Starting Normal TCP listening on TCP endpoint: 10.2.69.7:1113.
[00001,12,18:00:46.193] ReadIndex building...
[00001,12,18:00:46.193] ReadIndex rebuilding done: total processed 0 records, time elapsed: 00:00:00.0005260.
[00001,11,18:00:46.201] Starting Normal TCP listening on TCP endpoint: 10.2.69.7:1112.
[00001,11,18:00:46.212] Starting HTTP server on [http://*:2114/]...
[00001,11,18:00:46.214] HTTP server is up and listening on [http://*:2114/]
[00001,11,18:00:46.214] Starting HTTP server on [http://*:2113/]...
[00001,11,18:00:46.214] HTTP server is up and listening on [http://*:2113/]
[00001,11,18:00:46.229] SLOW QUEUE MSG [MainQueue]: SystemInit - 68ms. Q: 0/7.
[00001,11,18:00:46.229] ========== [10.2.69.7:2113] Service 'StorageWriter' initialized.
[00001,11,18:00:46.229] ========== [10.2.69.7:2113] Service 'StorageReader' initialized.
[00001,11,18:00:46.230] ========== [10.2.69.7:2113] Service 'StorageChaser' initialized.
[00001,11,18:00:46.231] ========== [10.2.69.7:2113] SYSTEM START...
[00001,11,18:00:46.235] ========== [10.2.69.7:2113] IS UNKNOWN...
[00001,11,18:00:46.262] ELECTIONS: STARTING ELECTIONS.
[00001,11,18:00:46.262] ELECTIONS: (V=0) SHIFT TO LEADER ELECTION.
[00001,11,18:00:46.263] ELECTIONS: (V=0) VIEWCHANGE FROM [10.2.69.7:2113, {001efee8-74b4-4fd9-931e-af9460e2555f}].
[00001,11,18:00:46.279] CLUSTER HAS CHANGED
[00001,11,18:00:46.279] Old:
[00001,11,18:00:46.279] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.237
[00001,11,18:00:46.279] New:
[00001,11,18:00:46.279] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.237
[00001,11,18:00:46.279] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.54.10:2113, 10.2.54.10:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.279] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.21.8:2113, 10.2.21.8:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.280] --------------------------------------------------------------------------------
[00001,06,18:00:46.280] Subscriptions received state change to Unknown stopping listening.
[00001,11,18:00:46.673] CLUSTER HAS CHANGED (gossip received from [10.2.54.10:2113])
[00001,11,18:00:46.673] Old:
[00001,11,18:00:46.673] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.588
[00001,11,18:00:46.673] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.54.10:2113, 10.2.54.10:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.674] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.21.8:2113, 10.2.21.8:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.674] New:
[00001,11,18:00:46.674] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.668
[00001,11,18:00:46.674] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.385
[00001,11,18:00:46.674] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.21.8:2113, 10.2.21.8:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.674] --------------------------------------------------------------------------------
[00001,11,18:00:46.747] CLUSTER HAS CHANGED (gossip received from [10.2.21.8:2113])
[00001,11,18:00:46.747] Old:
[00001,11,18:00:46.747] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.709
[00001,11,18:00:46.747] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.627
[00001,11,18:00:46.748] MAN {00000000-0000-0000-0000-000000000000} <LIVE> [Manager, 10.2.21.8:2113, 10.2.21.8:2113] | 2017-01-25 18:00:46.264
[00001,11,18:00:46.748] New:
[00001,11,18:00:46.748] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Unknown, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.747
[00001,11,18:00:46.748] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.627
[00001,11,18:00:46.748] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Unknown, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:46.573
[00001,11,18:00:46.748] --------------------------------------------------------------------------------
[00001,11,18:00:47.282] ELECTIONS: (V=0) TIMED OUT! (S=ElectingLeader, M=).
[00001,11,18:00:47.282] ELECTIONS: (V=1) SHIFT TO LEADER ELECTION.
[00001,11,18:00:47.282] ELECTIONS: (V=1) VIEWCHANGE FROM [10.2.69.7:2113, {001efee8-74b4-4fd9-931e-af9460e2555f}].
Segments count: 1, buffers count: 512, should be when full: 512
[00001,11,18:00:47.294] ELECTIONS: (V=1) VIEWCHANGE FROM [10.2.21.8:2113, {ab44c397-ac19-4844-9595-93f44e07f2c4}].
[00001,11,18:00:47.294] ELECTIONS: (V=1) MAJORITY OF VIEWCHANGE.
[00001,11,18:00:47.297] ELECTIONS: (V=1) VIEWCHANGE FROM [10.2.54.10:2113, {5b3f3bee-34d3-41ec-a186-0c80707a8ed7}].
[00001,11,18:00:47.303] ELECTIONS: (V=1) PREPARE FROM [10.2.54.10:2113, {5b3f3bee-34d3-41ec-a186-0c80707a8ed7}].
[00001,11,18:00:47.303] ELECTIONS: (V=1) SHIFT TO REG_NONLEADER.
[00001,11,18:00:47.325] ELECTIONS: (V=1) PROPOSAL FROM [10.2.54.10:2113,{5b3f3bee-34d3-41ec-a186-0c80707a8ed7}] M=[10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}](L=-1,W=0,C=0,E-1@-1:{00000000-0000-0000-0000-000000000000}). ME=[10.2.69.7:2113,{001efee8-74b4-4fd9-931e-af9460e2555f}](L=-1,W=0,C=0,E-1@-1:{00000000-0000-0000-0000-000000000000}).
[00001,11,18:00:47.325] ELECTIONS: (V=1) ACCEPT FROM [10.2.54.10:2113,{5b3f3bee-34d3-41ec-a186-0c80707a8ed7}] M=[10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]).
[00001,11,18:00:47.325] ELECTIONS: (V=1) ACCEPT FROM [10.2.69.7:2113,{001efee8-74b4-4fd9-931e-af9460e2555f}] M=[10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]).
[00001,11,18:00:47.326] ELECTIONS: (V=1) DONE. ELECTED MASTER = [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}](L=-1,W=0,C=0,E-1@-1:{00000000-0000-0000-0000-000000000000}). ME=[10.2.69.7:2113,{001efee8-74b4-4fd9-931e-af9460e2555f}](L=-1,W=0,C=0,E-1@-1:{00000000-0000-0000-0000-000000000000}).
[00001,11,18:00:47.326] ========== [10.2.69.7:2113] PRE-REPLICA STATE, WAITING FOR CHASER TO CATCH UP... MASTER IS [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]
[00001,06,18:00:47.330] Subscriptions received state change to PreReplica stopping listening.
[00001,06,18:00:47.386] Connection 'master-normal' ({f7fefc1a-b018-4a98-989e-420c8d3e8ced}) to [10.2.21.8:1112] established.
[00001,11,18:00:47.397] Subscribing at LogPosition: 0 (0x0) to MASTER [10.2.21.8:1112, {ab44c397-ac19-4844-9595-93f44e07f2c4}] as replica with SubscriptionId: {cb867e6b-b4b7-4a62-9a06-6c4665357e1f}, ConnectionId: {f7fefc1a-b018-4a98-989e-420c8d3e8ced}, LocalEndPoint: [10.2.69.7:53374], Epochs:
...
.
[00001,11,18:00:47.439] SLOW BUS MSG [MainBus]: SubscribeToMaster - 52ms. Handler: ReplicaService.
[00001,11,18:00:47.439] SLOW QUEUE MSG [MainQueue]: ChaserCaughtUp - 77ms. Q: 0/5.
[00001,11,18:00:47.440] ELECTIONS: (V=1) ACCEPT FROM [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}] M=[10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]).
[00001,11,18:00:47.484] CLUSTER HAS CHANGED (gossip received from [10.2.21.8:2113])
[00001,11,18:00:47.484] Old:
[00001,11,18:00:47.484] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [PreReplica, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.440
[00001,11,18:00:47.484] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.208
[00001,11,18:00:47.484] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Unknown, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.440
[00001,11,18:00:47.484] New:
[00001,11,18:00:47.485] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [PreReplica, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.484
[00001,11,18:00:47.485] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.228
[00001,11,18:00:47.485] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] -1/304/168/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.334
[00001,11,18:00:47.485] --------------------------------------------------------------------------------
[00001,11,18:00:47.587] CLUSTER HAS CHANGED (gossip received from [10.2.21.8:2113])
[00001,11,18:00:47.587] Old:
[00001,11,18:00:47.587] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [PreReplica, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.559
[00001,11,18:00:47.587] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Unknown, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.228
[00001,11,18:00:47.587] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] -1/304/168/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.334
[00001,11,18:00:47.587] New:
[00001,11,18:00:47.587] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [PreReplica, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.587
[00001,11,18:00:47.587] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [PreReplica, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.431
[00001,11,18:00:47.587] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] 468/630/630/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.431
[00001,11,18:00:47.587] --------------------------------------------------------------------------------
[00001,11,18:00:47.594] ========== [10.2.69.7:2113] IS CATCHING UP... MASTER IS [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]
[00001,15,18:00:47.600] Subscriptions received state change to CatchingUp stopping listening.
[00001,08,18:00:47.614] === SUBSCRIBED to [10.2.21.8:1112,{ab44c397-ac19-4844-9595-93f44e07f2c4}] at 0 (0x0). SubscriptionId: {cb867e6b-b4b7-4a62-9a06-6c4665357e1f}.
[00001,11,18:00:47.634] ========== [10.2.69.7:2113] CLONE ASSIGNMENT RECEIVED FROM [10.2.21.8:1112,n/a,{ab44c397-ac19-4844-9595-93f44e07f2c4}].
[00001,11,18:00:47.634] ========== [10.2.69.7:2113] IS CLONE... MASTER IS [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]
[00001,11,18:00:47.634] ========== [10.2.69.7:2113] SLAVE ASSIGNMENT RECEIVED FROM [10.2.21.8:1112,n/a,{ab44c397-ac19-4844-9595-93f44e07f2c4}].
[00001,11,18:00:47.635] ========== [10.2.69.7:2113] IS SLAVE... MASTER IS [10.2.21.8:2113,{ab44c397-ac19-4844-9595-93f44e07f2c4}]
[00001,06,18:00:47.635] Subscriptions received state change to Clone stopping listening.
[00001,06,18:00:47.635] Subscriptions received state change to Slave stopping listening.
[00001,12,18:00:47.653] === Update Last Epoch E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} (previous epoch at -1).
[00001,11,18:00:47.681] CLUSTER HAS CHANGED (gossip received from [10.2.21.8:2113])
[00001,11,18:00:47.681] Old:
[00001,11,18:00:47.681] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Slave, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] 168/903/304/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.673
[00001,11,18:00:47.681] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [PreReplica, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.431
[00001,11,18:00:47.681] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] 468/630/630/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.450
[00001,11,18:00:47.681] New:
[00001,11,18:00:47.681] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Slave, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] 767/903/903/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.681
[00001,11,18:00:47.689] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [CatchingUp, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.518
[00001,11,18:00:47.689] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] 767/903/903/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.526
[00001,11,18:00:47.689] --------------------------------------------------------------------------------
[00001,15,18:00:47.691] Created stats stream '$stats-10.2.69.7:2114', code = WrongExpectedVersion
[00001,15,18:00:47.691] Created stats stream '$stats-10.2.69.7:2114', code = WrongExpectedVersion
[00001,11,18:00:47.794] CLUSTER HAS CHANGED (gossip received from [10.2.21.8:2113])
[00001,11,18:00:47.794] Old:
[00001,11,18:00:47.794] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Slave, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] 1577/1803/1677/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.775
[00001,11,18:00:47.794] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [CatchingUp, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/0/0/E-1@-1:{00000000-0000-0000-0000-000000000000} | 2017-01-25 18:00:47.518
[00001,11,18:00:47.794] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] 767/903/903/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.526
[00001,11,18:00:47.794] New:
[00001,11,18:00:47.794] VND {001efee8-74b4-4fd9-931e-af9460e2555f} <LIVE> [Slave, 10.2.69.7:1112, 10.2.69.7:0, 10.2.69.7:1113, 10.2.69.7:0, 10.2.69.7:2113, 10.2.69.7:2114] 1803/1926/1926/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.794
[00001,11,18:00:47.794] VND {5b3f3bee-34d3-41ec-a186-0c80707a8ed7} <LIVE> [Slave, 10.2.54.10:1112, n/a, 10.2.54.10:1113, n/a, 10.2.54.10:2113, 10.2.54.10:2114] -1/1475/304/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.618
[00001,11,18:00:47.794] VND {ab44c397-ac19-4844-9595-93f44e07f2c4} <LIVE> [Master, 10.2.21.8:1112, n/a, 10.2.21.8:1113, n/a, 10.2.21.8:2113, 10.2.21.8:2114] 1803/1926/1926/E0@0:{ce23eb48-36c5-4fba-ba2a-4d33e71ef8cd} | 2017-01-25 18:00:47.630
[00001,11,18:00:47.794] --------------------------------------------------------------------------------
[00001,06,18:03:11.597] External TCP connection accepted: [Normal, 10.2.69.8:55910, L10.2.69.7:1113, {3559f41d-cb8d-4099-967b-855108c9afe4}].
[00001,15,18:03:11.745] ES TcpConnection closed [18:03:11.736: N10.2.69.8:55910, L10.2.69.7:1113, {3559f41d-cb8d-4099-967b-855108c9afe4}]:Received bytes: 48, Sent bytes: 54
[00001,15,18:03:11.745] ES TcpConnection closed [18:03:11.745: N10.2.69.8:55910, L10.2.69.7:1113, {3559f41d-cb8d-4099-967b-855108c9afe4}]:Send calls: 1, callbacks: 1
[00001,15,18:03:11.745] ES TcpConnection closed [18:03:11.745: N10.2.69.8:55910, L10.2.69.7:1113, {3559f41d-cb8d-4099-967b-855108c9afe4}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:11.745] ES TcpConnection closed [18:03:11.745: N10.2.69.8:55910, L10.2.69.7:1113, {3559f41d-cb8d-4099-967b-855108c9afe4}]:Close reason: [Success] Socket closed
[00001,15,18:03:11.746] Connection 'external-normal' [10.2.69.8:55910, {3559f41d-cb8d-4099-967b-855108c9afe4}] closed: Success.
[00001,06,18:03:11.747] Lost connection from 10.2.69.8:55910
[00001,06,18:03:11.968] External TCP connection accepted: [Normal, 10.2.69.8:55914, L10.2.69.7:1113, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}].
[00001,15,18:03:12.773] ES TcpConnection closed [18:03:12.773: N10.2.69.8:55914, L10.2.69.7:1113, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}]:Received bytes: 70, Sent bytes: 76
[00001,15,18:03:12.773] ES TcpConnection closed [18:03:12.773: N10.2.69.8:55914, L10.2.69.7:1113, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}]:Send calls: 2, callbacks: 2
[00001,15,18:03:12.773] ES TcpConnection closed [18:03:12.773: N10.2.69.8:55914, L10.2.69.7:1113, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:12.773] ES TcpConnection closed [18:03:12.773: N10.2.69.8:55914, L10.2.69.7:1113, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}]:Close reason: [Success] Socket closed
[00001,15,18:03:12.773] Connection 'external-normal' [10.2.69.8:55914, {bc383a76-f293-4ca7-ab60-4b1e47dacc11}] closed: Success.
[00001,06,18:03:12.773] Lost connection from 10.2.69.8:55914
[00001,06,18:03:12.976] External TCP connection accepted: [Normal, 10.2.69.8:55918, L10.2.69.7:1113, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}].
[00001,06,18:03:13.783] ES TcpConnection closed [18:03:13.783: N10.2.69.8:55918, L10.2.69.7:1113, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}]:Received bytes: 70, Sent bytes: 76
[00001,06,18:03:13.783] ES TcpConnection closed [18:03:13.784: N10.2.69.8:55918, L10.2.69.7:1113, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}]:Send calls: 2, callbacks: 2
[00001,06,18:03:13.783] ES TcpConnection closed [18:03:13.784: N10.2.69.8:55918, L10.2.69.7:1113, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}]:Receive calls: 2, callbacks: 2
[00001,06,18:03:13.783] ES TcpConnection closed [18:03:13.784: N10.2.69.8:55918, L10.2.69.7:1113, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}]:Close reason: [Success] Socket closed
[00001,06,18:03:13.783] Connection 'external-normal' [10.2.69.8:55918, {ffbc00b1-5cd6-4bd6-8feb-f9419ec072c4}] closed: Success.
[00001,15,18:03:13.783] Lost connection from 10.2.69.8:55918
[00001,06,18:03:13.986] External TCP connection accepted: [Normal, 10.2.69.8:55922, L10.2.69.7:1113, {fea6794e-f1f9-4564-93ca-732beccc4c1a}].
[00001,15,18:03:14.789] ES TcpConnection closed [18:03:14.789: N10.2.69.8:55922, L10.2.69.7:1113, {fea6794e-f1f9-4564-93ca-732beccc4c1a}]:Received bytes: 70, Sent bytes: 76
[00001,15,18:03:14.789] ES TcpConnection closed [18:03:14.790: N10.2.69.8:55922, L10.2.69.7:1113, {fea6794e-f1f9-4564-93ca-732beccc4c1a}]:Send calls: 2, callbacks: 2
[00001,15,18:03:14.789] ES TcpConnection closed [18:03:14.790: N10.2.69.8:55922, L10.2.69.7:1113, {fea6794e-f1f9-4564-93ca-732beccc4c1a}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:14.789] ES TcpConnection closed [18:03:14.790: N10.2.69.8:55922, L10.2.69.7:1113, {fea6794e-f1f9-4564-93ca-732beccc4c1a}]:Close reason: [Success] Socket closed
[00001,15,18:03:14.789] Connection 'external-normal' [10.2.69.8:55922, {fea6794e-f1f9-4564-93ca-732beccc4c1a}] closed: Success.
[00001,15,18:03:14.789] Lost connection from 10.2.69.8:55922
[00001,06,18:03:14.993] External TCP connection accepted: [Normal, 10.2.69.8:55926, L10.2.69.7:1113, {81c4d906-2b77-417d-94ab-f07865e706b2}].
[00001,15,18:03:15.795] ES TcpConnection closed [18:03:15.795: N10.2.69.8:55926, L10.2.69.7:1113, {81c4d906-2b77-417d-94ab-f07865e706b2}]:Received bytes: 70, Sent bytes: 76
[00001,15,18:03:15.795] ES TcpConnection closed [18:03:15.795: N10.2.69.8:55926, L10.2.69.7:1113, {81c4d906-2b77-417d-94ab-f07865e706b2}]:Send calls: 2, callbacks: 2
[00001,15,18:03:15.795] ES TcpConnection closed [18:03:15.795: N10.2.69.8:55926, L10.2.69.7:1113, {81c4d906-2b77-417d-94ab-f07865e706b2}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:15.795] ES TcpConnection closed [18:03:15.795: N10.2.69.8:55926, L10.2.69.7:1113, {81c4d906-2b77-417d-94ab-f07865e706b2}]:Close reason: [Success] Socket closed
[00001,15,18:03:15.795] Connection 'external-normal' [10.2.69.8:55926, {81c4d906-2b77-417d-94ab-f07865e706b2}] closed: Success.
[00001,06,18:03:15.795] Lost connection from 10.2.69.8:55926
[00001,15,18:03:15.998] External TCP connection accepted: [Normal, 10.2.69.8:55930, L10.2.69.7:1113, {d01024af-16f1-4586-a277-ffc4de1b2bd4}].
[00001,06,18:03:16.800] ES TcpConnection closed [18:03:16.800: N10.2.69.8:55930, L10.2.69.7:1113, {d01024af-16f1-4586-a277-ffc4de1b2bd4}]:Received bytes: 70, Sent bytes: 76
[00001,06,18:03:16.801] ES TcpConnection closed [18:03:16.801: N10.2.69.8:55930, L10.2.69.7:1113, {d01024af-16f1-4586-a277-ffc4de1b2bd4}]:Send calls: 2, callbacks: 2
[00001,06,18:03:16.801] ES TcpConnection closed [18:03:16.801: N10.2.69.8:55930, L10.2.69.7:1113, {d01024af-16f1-4586-a277-ffc4de1b2bd4}]:Receive calls: 2, callbacks: 2
[00001,06,18:03:16.801] ES TcpConnection closed [18:03:16.801: N10.2.69.8:55930, L10.2.69.7:1113, {d01024af-16f1-4586-a277-ffc4de1b2bd4}]:Close reason: [Success] Socket closed
[00001,06,18:03:16.801] Connection 'external-normal' [10.2.69.8:55930, {d01024af-16f1-4586-a277-ffc4de1b2bd4}] closed: Success.
[00001,15,18:03:16.801] Lost connection from 10.2.69.8:55930
[00001,15,18:03:17.003] External TCP connection accepted: [Normal, 10.2.69.8:55934, L10.2.69.7:1113, {5a98dada-7cee-4a08-997c-bfcaa64663f1}].
[00001,15,18:03:17.816] ES TcpConnection closed [18:03:17.816: N10.2.69.8:55934, L10.2.69.7:1113, {5a98dada-7cee-4a08-997c-bfcaa64663f1}]:Received bytes: 70, Sent bytes: 76
[00001,15,18:03:17.816] ES TcpConnection closed [18:03:17.816: N10.2.69.8:55934, L10.2.69.7:1113, {5a98dada-7cee-4a08-997c-bfcaa64663f1}]:Send calls: 2, callbacks: 2
[00001,15,18:03:17.816] ES TcpConnection closed [18:03:17.817: N10.2.69.8:55934, L10.2.69.7:1113, {5a98dada-7cee-4a08-997c-bfcaa64663f1}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:17.816] ES TcpConnection closed [18:03:17.817: N10.2.69.8:55934, L10.2.69.7:1113, {5a98dada-7cee-4a08-997c-bfcaa64663f1}]:Close reason: [Success] Socket closed
[00001,15,18:03:17.816] Connection 'external-normal' [10.2.69.8:55934, {5a98dada-7cee-4a08-997c-bfcaa64663f1}] closed: Success.
[00001,06,18:03:17.816] Lost connection from 10.2.69.8:55934
[00001,06,18:03:18.018] External TCP connection accepted: [Normal, 10.2.69.8:55942, L10.2.69.7:1113, {0e111572-6f5b-4b94-aacb-537ec53d6656}].
[00001,15,18:03:18.823] ES TcpConnection closed [18:03:18.823: N10.2.69.8:55942, L10.2.69.7:1113, {0e111572-6f5b-4b94-aacb-537ec53d6656}]:Received bytes: 70, Sent bytes: 76
[00001,15,18:03:18.823] ES TcpConnection closed [18:03:18.824: N10.2.69.8:55942, L10.2.69.7:1113, {0e111572-6f5b-4b94-aacb-537ec53d6656}]:Send calls: 2, callbacks: 2
[00001,15,18:03:18.823] ES TcpConnection closed [18:03:18.824: N10.2.69.8:55942, L10.2.69.7:1113, {0e111572-6f5b-4b94-aacb-537ec53d6656}]:Receive calls: 2, callbacks: 2
[00001,15,18:03:18.823] ES TcpConnection closed [18:03:18.824: N10.2.69.8:55942, L10.2.69.7:1113, {0e111572-6f5b-4b94-aacb-537ec53d6656}]:Close reason: [Success] Socket closed
[00001,15,18:03:18.823] Connection 'external-normal' [10.2.69.8:55942, {0e111572-6f5b-4b94-aacb-537ec53d6656}] closed: Success.
[00001,06,18:03:18.823] Lost connection from 10.2.69.8:55942
[00001,06,18:03:19.024] External TCP connection accepted: [Normal, 10.2.69.8:55946, L10.2.69.7:1113, {b47a1e86-9773-4c64-b1ca-48c880cbe459}].
[00001,06,18:03:19.836] ES TcpConnection closed [18:03:19.836: N10.2.69.8:55946, L10.2.69.7:1113, {b47a1e86-9773-4c64-b1ca-48c880cbe459}]:Received bytes: 70, Sent bytes: 76
[00001,06,18:03:19.836] ES TcpConnection closed [18:03:19.837: N10.2.69.8:55946, L10.2.69.7:1113, {b47a1e86-9773-4c64-b1ca-48c880cbe459}]:Send calls: 2, callbacks: 2
[00001,06,18:03:19.836] ES TcpConnection closed [18:03:19.837: N10.2.69.8:55946, L10.2.69.7:1113, {b47a1e86-9773-4c64-b1ca-48c880cbe459}]:Receive calls: 2, callbacks: 2
[00001,06,18:03:19.836] ES TcpConnection closed [18:03:19.837: N10.2.69.8:55946, L10.2.69.7:1113, {b47a1e86-9773-4c64-b1ca-48c880cbe459}]:Close reason: [Success] Socket closed
[00001,06,18:03:19.836] Connection 'external-normal' [10.2.69.8:55946, {b47a1e86-9773-4c64-b1ca-48c880cbe459}] closed: Success.
[00001,15,18:03:19.836] Lost connection from 10.2.69.8:55946
[00001,06,18:03:20.036] External TCP connection accepted: [Normal, 10.2.69.8:55950, L10.2.69.7:1113, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}].
[00001,06,18:03:20.843] ES TcpConnection closed [18:03:20.843: N10.2.69.8:55950, L10.2.69.7:1113, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}]:Received bytes: 70, Sent bytes: 76
[00001,06,18:03:20.843] ES TcpConnection closed [18:03:20.843: N10.2.69.8:55950, L10.2.69.7:1113, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}]:Send calls: 2, callbacks: 2
[00001,06,18:03:20.843] ES TcpConnection closed [18:03:20.843: N10.2.69.8:55950, L10.2.69.7:1113, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}]:Receive calls: 3, callbacks: 3
[00001,06,18:03:20.843] ES TcpConnection closed [18:03:20.843: N10.2.69.8:55950, L10.2.69.7:1113, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}]:Close reason: [Success] Socket closed
[00001,06,18:03:20.843] Connection 'external-normal' [10.2.69.8:55950, {94e8c4ce-67dd-4cd0-b452-9f7f06acb400}] closed: Success.
[00001,15,18:03:20.843] Lost connection from 10.2.69.8:55950
[00001,06,18:03:21.044] External TCP connection accepted: [Normal, 10.2.69.8:55954, L10.2.69.7:1113, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}].
[00001,06,18:03:21.851] ES TcpConnection closed [18:03:21.851: N10.2.69.8:55954, L10.2.69.7:1113, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}]:Received bytes: 70, Sent bytes: 76
[00001,06,18:03:21.851] ES TcpConnection closed [18:03:21.851: N10.2.69.8:55954, L10.2.69.7:1113, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}]:Send calls: 2, callbacks: 2
[00001,06,18:03:21.851] ES TcpConnection closed [18:03:21.851: N10.2.69.8:55954, L10.2.69.7:1113, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}]:Receive calls: 2, callbacks: 2
[00001,06,18:03:21.851] ES TcpConnection closed [18:03:21.851: N10.2.69.8:55954, L10.2.69.7:1113, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}]:Close reason: [Success] Socket closed
[00001,06,18:03:21.851] Connection 'external-normal' [10.2.69.8:55954, {4896b3be-0f83-4ed4-8e6d-8005e1426f75}] closed: Success.
[00001,15,18:03:21.851] Lost connection from 10.2.69.8:55954
[00001,15,18:03:22.054] External TCP connection accepted: [Normal, 10.2.69.8:55958, L10.2.69.7:1113, {6ddbcaad-bd89-473c-abd8-0d5e68761298}].

basic connection pattern

Hi, I'm trying to just get a basic connection singleton that will reconnect on close or disconnect. I was just wondering if you have a basic pattern that you use for this. I've tried a couple different ones and they seem to intermittently close. I know this is not your code that's wrong, but my implementation.
Here's what I have

module.exports = function(nodeeventstoreclient, promiseretry, logger) {
  let connection;
  let connectionState = '';
  const getConnection = options => {
    if (connectionState === 'connected') {
      return connection;
    }

    if (!connection || connectionState === 'closed') {
      connection = nodeeventstoreclient.createConnection(
        {verbose: options.verbose, log: logger},
        {host: options.host, port: 1113});
    }

    connection.connect();

    connection.once('connected', tcpEndPoint => {
      connectionState = 'connected';
      console.log(`=========='connected'=========`);
      console.log('connected to eventstore');
      console.log(`==========END 'connected'=========`);
      logger.trace(`gesConnection: ${connection._connectionName}
 - ${JSON.stringify(tcpEndPoint, null, 4)}`);
    });

    connection.on('error', function(err) {
      connectionState = 'error';
      logger.error(`Error occurred on ES connection: ${connection._connectionName}`, err);
    });

    connection.on('closed', function(reason) {
      connectionState = 'closed';
      console.log(`==========CLOSED!!!!=========`);
      console.log('CLOSED!!!!');
      console.log(`==========END CLOSED!!!!=========`);

      logger.info(`ES connection: ${connection._connectionName} closed, reason:`, reason);
      connection = getConnection(options);
    });

    connection.on('disconnected', function(reason) {
      connectionState = 'closed';
      console.log(`=========="DISCONNECTED!!!"=========`);
      console.log('DISCONNECTED!!!');
      console.log(`==========END "DISCONNECTED!!!"=========`);

      logger.info(`ES connection: ${connection._connectionName} disconnected, reason:`, reason);
      connection = getConnection(options);
    });

    return connection;
  };
  return getConnection;
};

then I have another module that exposes it and some functionality like so

module.exports = function(nodeeventstoreclient, eventstoreConnection, logger, events, uuid) {
  return function eventstore(options) {
    const configs = options.eventstore;
    const credentialsForAllEventsStream =
      new nodeeventstoreclient.UserCredentials(configs.systemUsers.admin, configs.systemUsers.adminPassword);

    const eventEmitterInstance = () => {
      const emitter = new events.EventEmitter();
      const emitEvent = (sub, e) => {
        emitter.emit('event', e);
      };
      return {
        emitter,
        emitEvent
      };
    };

    const liveProcessingStarted = () => {
      logger.trace('Caught up with previously stored events. Listening for new events.');
    };

    const subscriptionDropped = (subscription, reason, error) => {
      if (error) {
        logger.error(error);
      }
      logger.info('Subscription dropped.');
    };

    let connection = async () => {
      const conn = await eventstoreConnection(configs);
      if (conn._handler.state !== 'connected') {
        let msg = `Connection: ${conn._connectionName} is not connected!`;
        logger.error(msg);
        throw new Error(msg);
      }
      return conn;
    };

    const commandPoster = async function(command, commandName, continuationId) {
      // fortify commands with metadata like date and user
      let conn = await connection;
      command.createDate = new Date();
      let event = nodeeventstoreclient.createJsonEventData(
        uuid.v4(),
        command,
        {eventName: commandName, continuationId, streamType: 'command'},
        commandName);
      await conn.appendToStream(
        'command',
        nodeeventstoreclient.expectedVersion.any,
        [event],
        credentialsForAllEventsStream);
    };

    return {
      eventEmitterInstance,
      liveProcessingStarted,
      subscriptionDropped,
      gesConnection: connection,
      createEventData: nodeeventstoreclient.createEventData,
      createJsonEventData: nodeeventstoreclient.createJsonEventData,
      expectedVersion: nodeeventstoreclient.expectedVersion,
      credentials: credentialsForAllEventsStream,
      commandPoster
    };
  };
};

I used to expose the connection like this

let connection = eventstoreConnection(configs); 

that seems to work when accessed like this

something.appendToSteam()

but the command poster logic is 50/50.

I'm just hoping you have a simpler better pattern that works for you.
Thanks,
R

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.