# webmiddle-service-parallel

> > Its purpose is similar to Pipe, i.e. the execution of services, but they are executed concurrently.

Latest version **0.3.0** (published 2018-04-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install webmiddle-service-parallel
pnpm add webmiddle-service-parallel
yarn add webmiddle-service-parallel
bun add webmiddle-service-parallel
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2018-04-12 |
| First published | 2016-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^6.9.0 \|\| >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Manuel Dell'Elce |
| Maintainers | maluen |
| Keywords | web, data, integration, extraction, scraper, jsx, framework |

## Links

- npm: https://www.npmjs.com/package/webmiddle-service-parallel
- Repository: https://github.com/webmiddle/webmiddle
- Homepage: https://github.com/webmiddle/webmiddle#readme
- Issues: https://github.com/webmiddle/webmiddle/issues
- npm.io page: https://npm.io/package/webmiddle-service-parallel

## Dependencies (1)

- [webmiddle](https://npm.io/package/webmiddle.md) ^0.3.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2018-04-12
- 0.2.0 — 2017-04-27
- 0.1.1 — 2017-01-24
- 0.1.0 — 2017-01-21
- 0.0.1 — 2016-06-27

## README

# webmiddle-service-parallel 

> Its purpose is similar to Pipe, i.e. the execution of services, but they are executed concurrently.

## Install

```bash
npm install --save webmiddle-service-parallel
```

## Usage

```jsx
import { PropTypes, rootContext } from 'webmiddle';
import Parallel from 'webmiddle-service-parallel';

const MyService = () => (
  <Parallel name="myResources">
    <SubService1
      name="resource1"
    />

    <SubService2
      name="resource2"
      {/*...*/}
    />

    <SubService3
      name="resource3"
      {/*...*/}
    />
  </Parallel>
);

rootContext.evaluate(<MyService />)
.then(resource => {
  console.log(resource.name); // "myResources" 
  console.log(resource.contentType); // "application/json"
  console.log(resource.content); // { resource1, resource2, resource3 }
});
```

## How it works

If every child is fully synchronous, then its behavior is the
same of Pipe.<br />
In the other end, if the child returns a promise, then such promise will
be added to a pool and the next child will be executed immediately.

The service resolves with a JSON resource whose content is an object
`<resource name, resource>`, where the resource names are extracted
directly from the resources returned by the children.

If any of the child fails, then the whole Parallel fails with the error
returned by the failed child.

This service also supports a **limit** property that can be used to
limit the maximum number of concurrent tasks that should be running at
any given time. If limit is 1, then the children will be executed in
order, one after another, similarly to the Pipe service.

## Properties

Name                   | Description
-----------------------|------------------------------------------------------
name                   | The name of the returned resource.
limit (optional)       | An integer for setting the maximum concurrency.
children               | The tasks to execute.

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