# @ordermentum/steveo

> A Task Pub/Sub Background processing library

Latest version **5.1.0-beta** (published 2023-01-24) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ordermentum/steveo
pnpm add @ordermentum/steveo
yarn add @ordermentum/steveo
bun add @ordermentum/steveo
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.1.0-beta |
| Published | 2023-01-24 |
| First published | 2023-01-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 14 |
| Unpacked size | 112.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 22 |
| Author | engineering@ordermentum.com |
| Maintainers | mariancastro, tjcoyoca, zdcatom, kgstaana-ordermentum, rraymundo19, johndagostino, ishmeet-ordermentum |

## Links

- npm: https://www.npmjs.com/package/@ordermentum/steveo
- Repository: https://github.com/ordermentum/steveo
- Homepage: https://github.com/ordermentum/steveo#readme
- Issues: https://github.com/ordermentum/steveo/issues
- npm.io page: https://npm.io/package/@ordermentum/steveo

## Dependencies (14)

- [rsmq](https://npm.io/package/rsmq.md) ^0.12.4
- [uuid](https://npm.io/package/uuid.md) ^8.0.0
- [moment](https://npm.io/package/moment.md) 2.29.4
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1043.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.7.2
- [lazy-object](https://npm.io/package/lazy-object.md) ^1.0.1
- [null-logger](https://npm.io/package/null-logger.md) ^2.0.0
- [generic-pool](https://npm.io/package/generic-pool.md) ^3.8.2
- [lodash.merge](https://npm.io/package/lodash.merge.md) 4.6.2
- [node-rdkafka](https://npm.io/package/node-rdkafka.md) ^2.13.0
- [lodash.shuffle](https://npm.io/package/lodash.shuffle.md) ^4.2.0
- [@types/bluebird](https://npm.io/package/@types/bluebird.md) ^3.5.38
- [lodash.difference](https://npm.io/package/lodash.difference.md) ^4.5.0
- [lodash.intersection](https://npm.io/package/lodash.intersection.md) ^4.4.0

## Recent versions

- 5.1.0-beta (latest) — 2023-01-24

## README

<h1 align="center">Welcome to steveo 👋</h1>
<p>
  <a href="https://www.npmjs.com/package/steveo" target="_blank">
    <img alt="Version" src="https://img.shields.io/npm/v/steveo.svg">
  </a>
  <a href="#" target="_blank">
    <img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
  </a>
</p>

[![npm version](https://badge.fury.io/js/steveo.svg)](https://badge.fury.io/js/steveo)
[![CI](https://github.com/ordermentum/steveo/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/ordermentum/steveo/actions/workflows/main.yml)
[![npm](https://img.shields.io/npm/l/steveo.svg)](https://www.npmjs.com/package/steveo)
[![npm](https://img.shields.io/npm/dt/steveo.svg)](https://www.npmjs.com/package/steveo)

A Task Pub/Sub Background processing library (Task Framework for Node.js)

Steveo is a task management library that supports Kafka, SQS and Redis.

Think of it as [sidekiq](https://github.com/mperham/sidekiq) for node.js with support for multiple backends.

## Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 12 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

```bash
$ npm install steveo
```

## Author

👤 **engineering@ordermentum.com**

### Task

Holds the information about the type of task. It has below methods,

- publish - send a message onto a queue
- subscribe - process a message

### Registry

Responsible for keeping the inventory of tasks & event manager. Whenever a new task is created, an entry will be added in the registry

### Runner

Responsible for consuming messages,

- `process` method initialize group consumers and start to consume the messages. It will then call the subscribe callback set on the task

Emitting events based on success/failures

- runner_receive -> Received a message
- runner_complete -> Completed running the associated task
- runner_failure -> Failed running the associated task
- runner_connection_failure -> Error while polling for message (Kafka only)

- task_send
- task_success
- task_failure
- task_added
- task_removed

- producer_success
- producer_failure

### Example

```javascript
(async () => {
  const steveo = Steveo({
    kafkaConnection: process.env.KAFKA_CONNECTION,
    clientId: '1234-123',
  });

  const example = steveo.task('example-task', async ({ name }) => {
    console.log(`hello ${name}`);
  });

  await example.publish({ name: 'tommo' });
  await example.publish({ name: 'bazza' });

  await steveo.runner().process();
})();
```

Publish without registering a task

```javascript
await steveo.publish('example-task', { name: 'Apple' });
```

For more details, see [example](https://github.com/ordermentum/steveo/blob/master/examples/full/README.md)


## Contributing


### Installing dependencies

```sh
yarn install
```

## Running tests

```sh
yarn run test
```


## Architecture

On a highlevel, it works as below, Steveo has 3 main components

```
              +-----------+     +-----------+     +-----------+
              |           |     |           |     |           |
PUBLISH ----->|   TASK    |     | REGISTRY  |     |   RUNNER  |-----> RECEIVE
              |           |     |           |     |           |
              |           |     |           |     |           |
              +-----------+     +-----------+     +-----------+
```


_Credits_

- [nokafka](https://github.com/oleksiyk/kafka)
- [rsmq](https://github.com/smrchy/rsmq)
- [aws-sdk](https://github.com/aws/aws-sdk-js)

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