0.1.20 • Published 5 years ago
@mgfx/connector-redis v0.1.20
@mgfx/connector-redis
An mgFx connector that uses Redis to provide a distributed Task processing mechanism.
Usage
- Install
@mgfx/connector-redisinto your existing mgFx application:
$ yarn add @mgfx/connector-redis- 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)
});- 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}!`));- 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
6 years ago
0.1.32
6 years ago
0.1.31
6 years ago
0.1.30
6 years ago
0.1.29
6 years ago
0.1.28
6 years ago
0.1.27
6 years ago
0.1.26
6 years ago
0.1.24
6 years ago
0.1.25
6 years ago
0.1.23
6 years ago
0.1.22
6 years ago
0.1.21
6 years ago
0.1.20
6 years ago
0.1.17
6 years ago
0.1.18
6 years ago
0.1.19
6 years ago
0.1.15
6 years ago
0.1.16
6 years ago
0.1.14
6 years ago
0.1.12
6 years ago
0.1.13
6 years ago
0.1.11
6 years ago
0.1.10
6 years ago
0.1.8
6 years ago
0.1.9
6 years ago
0.1.7
6 years ago
0.1.6
6 years ago
0.1.4
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago