/cyberway.notifier

Service to broadcast cyberway events to receivers

Primary LanguageC++

Cyberway Notifier

CyberWay Notifier is a component of CyberWay Event Model and it looks like a messenger utility which passes the messages from the Event Engine to NATS. Notifier provides high reliability of the data transfer.

All event messages are represented in binary form. The smart contracts contain an ABI-description of each event transmitted in order for the Event Engine plug-in to deserialize such arguments and give the event a structured look. Using the ABI-description given in the event, the Event Engine plug-in converts the binary view of the received event into a structure form.

The event messages generated by the plug-in are recorded either in the file descriptor or transmitted to the pipeline depending on the settings.

Notifier opens the pipeline line, receives the event and sends it to the NATS. Then the node transmits to the line all the information about the event.

The Notifier provides the following features:

  • receives events from the Event Engine in the form of JSON messages indicating an arbitrary NATS channel to which the message should be sent.
  • sends messages in one of the synchronous or asynchronous modes.
  • saves the queue of unsent messages to the backup file when collecting the utility, and also restores them after a restart.
  • processes signals of the form SIGINT and SIGTERM.
  • handles interruptions like "connection with NATS" and "send timed out".
  • provides installation of NATS options using command line arguments.

More information about Event Engine model can be found here.

Requirements

prototype usage

The following notifier construction algorithm needs to be updated

  1. Build
  2. Start NATS Streaming with "cyberway" cluster_id: nats-streaming-server -cid=cyberway &
  3. Start notifier, connected to input file: tail -f -n+0 events.txt | path-to-binary/cyber-notifier &
  4. Connect clients to NATS Streaming, subscribe to topics, enable . Now we send AcceptTrx, ApplyTrx, CommitBlock, AcceptBlock
  5. Start nodeos with event-engine-plugin enabled and event dumpfile set:
nodeos -e -p eosio \
--plugin eosio::event_engine_plugin \
--event-engine-dumpfile ./events.txt \
…other options…