<!-- This file was generated by @travetto/doc and should not be modified directly -->
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/worker/DOC.tsx and execute "npx trv doc" to rebuild -->
# Worker

## Process management utilities, with a focus on inter-process communication

**Install: @travetto/worker**
```bash
npm install @travetto/worker

# or

yarn add @travetto/worker
```

This module provides the necessary primitives for handling dependent workers.  A worker can be an individual actor or could be a pool of workers. Node provides ipc (inter-process communication) functionality out of the box. This module builds upon that by providing enhanced event management, richer process management, as well as constructs for orchestrating a conversation between two processes.

## Execution Pools
With respect to managing multiple executions, [WorkPool](https://github.com/travetto/travetto/tree/main/module/worker/src/pool.ts#L34) is provided to allow for concurrent operation, and processing of jobs concurrently.  To manage the flow of jobs, [AsyncQueue](https://github.com/travetto/travetto/tree/main/module/runtime/src/queue.ts#L4) is used to support a wide range of use cases. [AsyncQueue](https://github.com/travetto/travetto/tree/main/module/runtime/src/queue.ts#L4) allows for manual control of iteration, which is useful for event driven work loads. 

## IPC Support
To handle communication between processes, [IpcChannel](https://github.com/travetto/travetto/tree/main/module/worker/src/ipc.ts#L9) is provided. This class abstracts the underlying IPC mechanism and provides a simple interface for sending and receiving messages. It also includes event management capabilities, allowing for easy handling of different message types. By default the class assumes it is running in a child process, but it can also be used in a parent process (by passing in the child process) to communicate with child processes.
