Skip to content

This is a plugin to use snappy compression with Hemera

License

Notifications You must be signed in to change notification settings

matikucharski/hemera-snappy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hemera-snappy package

This is modified fork of hemera-snappy.

This is a plugin to use Google Snappy with Hemera.

Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression.

Example

'use strict';

const Hemera = require('nats-hemera');
// Use NATS driver >= 0.7.2
const nats = require('nats').connect({ 
  // otherwise NATS will interpret all data as LATIN1 (binary encoding)
  preserveBuffers: true
});
const HemeraSnappy = require('@barbastudio/hemera-snappy');

const hemera = new Hemera(nats, {
  logLevel: 'info'
});

hemera.use(HemeraSnappy);

hemera.ready(() => {
  hemera.add({
    topic: 'math',
    cmd: 'add'
  }, (req, cb) => {

    cb(null, req.a + req.b)
  });

  hemera.act({
    topic: 'math',
    cmd: 'add',
    a: 1,
    b: 20
  }, function (err, resp) {

    this.log.info('Result', resp)
  });
});

About

This is a plugin to use snappy compression with Hemera

Resources

License

Stars

Watchers

Forks

Packages

No packages published