2.2.5 • Published 4 months ago

@haku-sci/utils v2.2.5

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

Description of the utils inside this package

This package is used by Haku-Sci, to handle different contents.

Microservices

Loading the class MicroserviceLib, it allows to fetch:

  • The name of the current microservice
  • default bootstrap for microservices

Consul

if consul is used, and env variabe CONSUL_URI is defined, then the lib allows as well:

  • to send messages to other services via TCP, and fetch the response if any
  • to emit message for all services via RabbitMQ

Docker

the start_services.bat method allows to run all required services from docker:

  • Consul
  • Neo4j
  • Postgresql
  • RabbitMQ

PostgreSQL

if the service uses a database PostgreSQL, and this database doesn't exist in the system, it will be created automatically (require the librarie pg)

RabbitMQ

Using RabbitMQService, lets implement dispatch of messages with an option to wait that all messages have been processed. A watchdog of 10 seconds raise an error Gateway timeout If the option is activated, a queue ackqueue\<name of the microservice> is created

The decorator HakuSciSubscriber allows to listen for a specific keyword. Each microservice which register with this decorator will have automatically a queue created, with its name. The exchanger is amq.topic

launch.json

The launch.json file allows to run all services (the microservice libs must be in the same directory as "services", which contains all services)

utils

executeFunction

lets call dynamically the function of an object, with parameters (Format: object as class, function name as string, parameters as dictionary)

getSortedParameters

for a function, get available parameters as dictionary, and return a list of parameters in correct order, to be run for this function (...args)

withWatchdog

Add a watchdog to a promise

1.2.0

10 months ago

1.8.2

7 months ago

1.4.6

9 months ago

1.2.8

9 months ago

1.8.1

8 months ago

1.4.5

9 months ago

1.2.7

10 months ago

1.8.0

8 months ago

1.4.4

9 months ago

1.2.6

10 months ago

1.6.1

9 months ago

1.4.3

9 months ago

1.2.5

10 months ago

1.6.0

9 months ago

1.4.2

9 months ago

1.2.4

10 months ago

1.4.1

9 months ago

1.2.3

10 months ago

1.4.0

9 months ago

1.2.2

10 months ago

1.2.1

10 months ago

2.2.1

5 months ago

2.2.0

5 months ago

2.2.3

4 months ago

2.2.2

4 months ago

2.2.5

4 months ago

2.2.4

4 months ago

2.0.1

5 months ago

2.0.0

5 months ago

1.9.7

6 months ago

1.9.6

6 months ago

1.9.5

7 months ago

1.9.4

7 months ago

1.9.3

7 months ago

1.9.2

7 months ago

1.2.10

9 months ago

1.9.1

7 months ago

1.9.0

7 months ago

1.7.1

8 months ago

1.7.0

8 months ago

1.5.0

9 months ago

1.3.0

9 months ago

1.4.9

9 months ago

1.4.8

9 months ago

1.4.10

9 months ago

1.4.7

9 months ago

1.2.9

9 months ago

1.10.0

6 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago