Hydra modes

Hydra may be configured for use in one of two modes:

  1. Service mode - acts as a service and consumer of other services.
  2. Consumer mode - only acts as a service consumer without itself being a service.

Service mode

To use Hydra in theService modeyou must first register it using:

hydra.registerService();

Note: if your application doesn't need to be a service then you don't need to perform this registration.

After a service is registered, hydra emits NodeJS events when log events are generated or messages arrive. You can listen for those events as follows:

hydra.registerService();
hydra.on('log', function(entry) {});
hydra.on('message', function(message) {});

Consumer mode

If a consumer mode application calls a service mode related method an exception or failed promise will result. Each call is clearly documented at the end of this document to help avoid misuse. But as always make sure your application is adequately tested.

results matching ""

    No results matching ""