# yodoya-activetick-adapter

> ActiveTick adapter for Yodoya - C&C and CEP

Latest version **3.0.0** (published 2017-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install yodoya-activetick-adapter
pnpm add yodoya-activetick-adapter
yarn add yodoya-activetick-adapter
bun add yodoya-activetick-adapter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2017-07-23 |
| First published | 2015-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jae Yang |
| Maintainers | dchem |
| Keywords | yodoya |

## Links

- npm: https://www.npmjs.com/package/yodoya-activetick-adapter
- Repository: https://gitlord.com/r/yodoya/yodoya-activetick-adapter
- Homepage: https://gitlord.com/summary/yodoya%2Fyodoya-activetick-adapter.git
- Issues: https://gitlord.com/tickets/yodoya%2Fyodoya-activetick-adapter.git?status=new&status=open
- npm.io page: https://npm.io/package/yodoya-activetick-adapter

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [protobuf-activetick](https://npm.io/package/protobuf-activetick.md) ^3.0.0

## Recent versions

- 3.0.0 (latest) — 2017-07-23
- 2.5.2 — 2017-07-22
- 2.5.1 — 2017-07-22
- 2.5.0 — 2017-07-18
- 2.3.0 — 2017-07-10
- 2.0.0 — 2017-07-09
- 1.3.0 — 2017-07-07
- 1.2.1 — 2015-12-07
- 1.2.0 — 2015-12-04
- 1.1.2 — 2015-11-16
- 1.1.1 — 2015-11-15
- 1.1.0 — 2015-11-14
- 1.0.5 — 2015-11-11
- 1.0.4 — 2015-11-10
- 1.0.3 — 2015-11-10
- … 3 more at https://npm.io/package/yodoya-activetick-adapter/versions

## README

## yodoya-activetick-adapter
[![Build Status](https://leeroy.gitlord.com/job/yodoya-activetick-adapter-n6.11.0-release/badge/icon)](https://leeroy.gitlord.com/job/yodoya-activetick-adapter-n6.11.0-release)

ActiveTick adapter for Yodoya - C&C and CEP

### Usage:

#### bindIncoming
`bindIncoming` binds the wiring socket (whether it be nanomsg, or kafka) to
a local observable stream (for an example Kefir). The function also takes an
option object whose members are the following:

`messageName` is a string of data name to be bound to `on` event handler.

`filter` is a function to specify whether to emit a decoded message to the `obs`
stream.

`getPayload` is a function to obtain payload from a received data.


For an example, for usage with `kafka-node` and `Kefir`:

```
const messageFilter = function (message) {
  return message.topic === 'mytopic'
}

const bindReqOptions = {
  messageName: 'message',
  filter: messageFilter,
  getPayload: function (buf) {
    return buf.value
  }
}

let kstream = Kefir.stream(function (_emitter) {
  kemitter = _emitter
  adapter.bindIncoming(consumer, kemitter, bindReqOptions, (err, res) => {
    if (err) return done(err)
  })
})
```

### sendEvent
`sendEvent` sends out Activetick data through some wire after encoding
it with a AT specific protocol buffer schema. The function also takes in
an option object:

`formatPayload` is a function to format a message intended to be sent out
given that outbound message may encapsulate the encoded data. For an example,
in Kafka, outbound message needs to specify `topic` and further encode the
protobuf encoded data into binary buffer.

`sendData` is a function that defines whether wiring library's `send` method
is synchronous or asynchronous.

For an example, for usage with `kafka-node`:

```
const makeOutboundMsg = function ( encodedData ) {
  let message = {
    topic: 'mytopic',
    messages: Buffer.from(encodedData)
  }
  return [message]
}

const respOptions = {
  formatPayload: makeOutboundMsg,
  sendData: function (socket, payload, cb) {
    return socket.send(payload, cb)
  }
}

adapter.sendEvent(producer, response, respOptions, (err, res) => {
  if (err) return done(err)
})
```

---
_Source: https://npm.io/package/yodoya-activetick-adapter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
