thenativeweb / node-cqrs-eventdenormalizer

Node-cqrs-eventdenormalizer is a node.js module that implements the cqrs pattern. It can be very useful as eventdenormalizer component if you work with (d)ddd, cqrs, domain, host, etc.
http://cqrs.js.org/pages/eventdenormalizer.html
MIT License
38 stars 27 forks source link

Reconnect if connect fails? #72

Closed blissi closed 6 years ago

blissi commented 6 years ago

Hallo, I'm using MongoDB. When Mongo is not started and I try to init the event store, it throws an exception:

MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]

Question 1: is there a way to instruct cqrs-eventdenormalizer to perform a retry? Same question goes to cqrs-domain.

Question 2: what about retries if the connection is initially fine and the event denormalizer starts up properly. Later Mongo goes down - how should I handle that situation?

Thanks, Steven

adrai commented 6 years ago

In all project I used these cqrs modules, I always killed the whole microservice when the connection to the database is interrupted...

But you should be able i.e. to pass the option: auto_reconnect: true for mongodb if you want to reconnect

blissi commented 6 years ago

Ok, so in your experience it is better to restart the microservice?

adrai commented 6 years ago

yes

blissi commented 6 years ago

Ok thanks.