0.1.20 • Published 5 years ago

@mgfx/connector-redis v0.1.20

Weekly downloads
38
License
ISC
Repository
github
Last release
5 years ago

@mgfx/connector-redis

An mgFx connector that uses Redis to provide a distributed Task processing mechanism.

Usage

  1. Install @mgfx/connector-redis into your existing mgFx application:
$ yarn add @mgfx/connector-redis
  1. Define a Task that is visible to both the 'producer' and 'consumer':
// tasks.ts
import { define } from 'mgfx';
import { ioTs, t } from '@mgfx/validator-iots';

export const myTask = define({
  name: 'myTask',
  input: ioTs(t.string),
  output: ioTs(t.string)
});
  1. Create a 'consumer' module that uses the Redis connector to serve an implementation of your Task:
// consumer.ts
import { implement } from 'mgfx';
import { redis } from '@mgx/connector-redis';
import { myTask } from './tasks';

const mgFx = redis();

mgFx.serve(implement(myTask, name => `Hello ${name}!`));
  1. Create a 'producer' module that uses the Redis connector to run Tasks in a distributed manner:
// producer.ts
import { redis } from '@mgx/connector-redis';
import { promise } from 'fluture';
import { myTask } from './tasks';

const mgFx = redis();

promise(mgFx.run(myTask('World'))).then(console.log);
0.1.37

5 years ago

0.1.38

5 years ago

0.1.39

5 years ago

0.1.35

5 years ago

0.1.36

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.24

5 years ago

0.1.25

5 years ago

0.1.23

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.17

5 years ago

0.1.18

5 years ago

0.1.19

5 years ago

0.1.15

5 years ago

0.1.16

5 years ago

0.1.14

5 years ago

0.1.12

5 years ago

0.1.13

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.8

5 years ago

0.1.9

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.4

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago