Global

Methods

messageSourceProxy(topic) → {rxjs.Observable}

Helper function to create a NATS topic observable,
that also prints the incoming data for debugging purposes

Parameters:
Name Type Description
topic String

The name of the NATS topic to observe

Returns:

the Observable object

Type
rxjs.Observable

natsTopicObservable(topic) → {rxjs.Observable}

Create an Observable, that acts as a source of data origin from a NATS topic

Parameters:
Name Type Description
topic String

The name of the NATS topic to observe

Returns:

the Observable object

Type
rxjs.Observable

natsTopicTapWriter(topic) → {Object}

A tap operator, that passes through the input data, but also writes it to a NATS topic

Parameters:
Name Type Description
topic String

The name of the NATS topic to write the data into

Returns:

the tap RxJS operator

Type
Object

natsTopicWriter(topic) → {function}

Send message to NATS topic

Parameters:
Name Type Description
topic String

The name of the NATS topic the payload will be sent

Returns:

The function with an {Object} payload argument that will be sent to the topic

Type
function

sendMessage(topic, payload)

Send message to NATS topic

Wrapper function to natsTopicWriter, to send a message within one function call.

Parameters:
Name Type Description
topic String

The name of the topic to send the message

payload Object

The message content to send

shutdown(container, next)

The shutdown function of the npacNatsRxjsGw adapter

This function should be registered with the shutdown phase, then npac will call when graceful shutdown happens.

Parameters:
Name Type Description
container Object

The actual state of the container this adapter is running

next function

Error-first callback function to pass the result partial container extended with the pdmsHemera adapter.

see also: the npac.startup process description.

startup(container, next)

The startup function of the adapter

This function should be registered with the startup phase, then npac will call when the project is starting.
After startup the adapter will provide the following API:

  • natsTopicObservable()
  • messageSourceProxy()
  • sendMessage()
  • natsTopicWriter()
  • natsTopicTapWriter()
Parameters:
Name Type Description
container Object

The actual state of the container this adapter will be added

next function

Error-first callback function to pass the result partial container extended with the pdmsHemera adapter.

see also: the npac.startup process description.