An open API service indexing awesome lists of open source software.

https://github.com/graphql-compose/graphql-compose-bullmq


https://github.com/graphql-compose/graphql-compose-bullmq

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# graphql-compose-bullmq

[![npm](https://img.shields.io/npm/v/graphql-compose-bullmq.svg)](https://www.npmjs.com/package/graphql-compose-bullmq)
[![trends](https://img.shields.io/npm/dt/graphql-compose-bullmq.svg)](http://www.npmtrends.com/graphql-compose-bullmq)
[![travis build](https://img.shields.io/travis/graphql-compose/graphql-compose-bullmq.svg)](https://travis-ci.org/graphql-compose/graphql-compose-bullmq)
[![Fully automated version management and package publishing](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

This is a plugin for [graphql-compose](https://github.com/graphql-compose/graphql-compose), which generates GraphQLTypes for [bullmq](https://github.com/taskforcesh/bullmq).

## Installation

```bash
npm install graphql graphql-compose bullmq graphql-compose-bullmq --save
```

Modules `graphql`, `graphql-compose`, `bullmq` are in `peerDependencies`, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.

## Example

```js
import { composeBull } from 'graphql-compose-bullmq';
import { schemaComposer } from 'graphql-compose';

const { queryFields, mutationFields } = composeBull({
schemaComposer,
typePrefix: 'Prefix',
jobDataTC: `type MyJobData { fieldA: String! fieldB: String}`,
queue: {
name: 'fetch_metrics',
prefix: 'bull.demo',
},
redis: 'redis://127.0.0.1:6379',
});

schemaComposer.Query.addFields({
...queryFields,
// Will provide the following fields:
// queueKeys
// queues
// queue
// job
});

schemaComposer.Mutation.addFields({
...mutationFields,
// Will provide the following fields:
// queueClean
// queueDrain
// queuePause
// queueResume
// queueRemoveRepeatable
// jobAdd
// jobAddBulk
// jobAddRepeatableCron
// jobAddRepeatableEvery
// jobDiscard
// jobPromote
// jobRemove
// jobRetry
// jobUpdate
// jobLogAdd
});

const schema = schemaComposer.buildSchema();
```

## Schema

`composeBull` will generate particles for your further schema. It contains more than 40 types wich helps to you work with Bull Queues. You may see generated files in [schema.graphql](./example/schema.graphql) file. It can be visialized with in the following manner:

### Queries

Screen Shot 2020-04-14 at 21 22 38

### Mutations

Screen Shot 2020-04-14 at 21 24 05

## License

[MIT](https://github.com/graphql-compose/graphql-compose-bullmq/blob/master/LICENSE.md)