## 1. Project Overview & Quickstart (roadrunner-server/jobs)

## File: docs/events.md

Different Jobs plugin drivers (aka: amqp, kafka, memory, etc.) might send events to stop or restart a pipeline because it's not possible from inside the driver (Jobs plugin controls the lifetime of its drivers).
This is a list of events that can be sent to the Jobs plugin to stop or restart a pipeline.

`event.Message`:
1. `stop` - Stops the pipeline.
2. `restart` - Restarts the pipeline.

`event.Plugin`:
1. The name of the pipeline to stop or restart.

---

## File: docs/response_protocol.md

Response protocol is used to communicate between a worker and RR.
When a worker completes its job, it should send a typed response.
The response should contain:

1. `type` field with the message type. Can be treated as enums.
2. `data` field with the dynamic response related to the type.

Types are:

```
0 - NO_ERROR [DEPRECATED], replaced with ACK
1 - ERROR [DEPRECATED], replaced with NACK/REQUEUE
2 - ACK
3 - NACK
4 - REQUEUE
```

#### `NO_ERROR`: contains only `type` - 0, and empty `data`.  
example:
```json
{
  "type": 0,
  "data": {}
}
```
---

#### `ERROR` : contains `type` - 1, and `data` field with: 
- `message` describing the error (type: string).  
- `requeue` flag to requeue the job (type: boolean).  
- `delay_seconds`: to delay a queue for a provided amount of seconds (type: integer).   
- `headers` - job's headers represented as hashmap with string key and array of strings as a value. (type `map[string][]string` (hash-table, key - string, value - array of strings))  

example:
```json
{
  "type": 1,
  "data": {
    "message": "internal worker error",
    "requeue": true,
    "headers": [
      {
        "test": [
          "1",
          "2",
          "3"
        ]
      }
    ],
    "delay_seconds": 10
  }
}
```

---


#### `ACK` : contains `type` - 2:

example:
```json
{
  "type": 2
}
```

---


#### `NACK` : contains `type` - 3, and `data` field with:
- `message` describing the error or message to print in the logs (type: string).
- `requeue` flag to requeue the job (type: boolean).
- `delay_seconds`: to delay a queue for a provided number of seconds (type: integer).

example:
```json
{
  "type": 3,
  "data": {
    "message": "internal worker error",
    "requeue": true,
    "delay_seconds": 10
  }
}
```


---


#### `REQUEUE` : contains `type` - 4, and `data` field with:
- `message` describing the error or message to print in the logs (type: string).
- `delay_seconds`: to delay a queue for a provided number of seconds (type: integer).
- `headers` - job's headers represented as hashmap with string key and array of strings as a value. (type `map[string][]string` (hash-table, key - string, value - array of strings))

example:
```json
{
  "type": 3,
  "data": {
    "message": "internal worker error",
    "delay_seconds": 10,
    "headers": [
      {
        "test": [
          "1",
          "2",
          "3"
        ]
      }
    ]
  }
}
```

## 2. Official Technical Reference & Guides (roadrunner-server/docs)

<figure>
  
    
    
  
</figure>



# Join our discord server: [Link](https://discord.gg/TFeEmCs)

RoadRunner is an open-source (MIT licensed) high-performance PHP application server and process manager written in Go and powered with plugins ❤️.
It supports running as a service with the ability to extend its functionality on a per-project basis with plugins and is designed to replace traditional Nginx+FPM setups with enhanced performance and versatility. With its wide range of features, RoadRunner is a production-ready solution that is PCI DSS compliant, ensuring the security and safety
of your web applications.

RoadRunner includes [PSR-7](https://www.php-fig.org/psr/psr-7), [PSR-17](https://www.php-fig.org/psr/psr-17) compatible HTTP and `HTTP(S)/2/3/fCGI` servers and can be used to replace classic Nginx+FPM setups with much greater performance and flexibility. `HTTP(S)/2/3/fCGI` servers as just one of its many available plugins, but its capabilities extend far beyond:

- Queue drivers: RabbitMQ, Kafka, SQS, Beanstalk, NATS, In-Memory.
- KV drivers: Redis, Memcached, BoltDB, In-Memory.
- OpenTelemetry protocol support (`gRPC`, `http`, `jaeger`).
- Workflows engine via [Temporal](https://temporal.io)
- `gRPC` server. For increased speed, the `protobuf` extension can be used.
- `HTTP(S)/2/3` and `fCGI` server features **automatic TLS management**, **103 Early Hints** support and middleware like: Static, Headers, gzip, prometheus (metrics), send (x-sendfile), OTEL, proxy_ip_parser, etc.
- Embedded distribute lock plugin which manages access to shared resources.
- Metrics server (you might easily expose your own).
- WebSockets and Broadcast via [Centrifugo](https://centrifugal.dev) server.
- Systemd-like services manager with auto-restarts, execution time limiter, etc.
- Embedded supervisor for your PHP workers with execution, max working time, and memory TTLs.
- Compatible with Windows, WSL2, FreeBSD, GNU/Linux, etc.
- And more 😉

If you have a feature request in mind, you can check
out [GitHub issues](https://github.com/roadrunner-server/roadrunner/issues) page. Here you'll find a list of open
feature requests. The RoadRunner community is active and responsive, so feel free to join the discussion on
our [Discord channel](https://discord.gg/spiralphp) or [contribute](intro/contributing.md) to the project.

[](https://discord.gg/spiralphp)

With the support of the community, RoadRunner will continue to grow and evolve to meet the needs of modern web
development.

## Useful articles
- [Scaling PHP applications with RoadRunner](https://betterstack.com/community/guides/scaling-php/php-roadrunner)
- [RoadRunner for PHP applications](https://butschster.medium.com/roadrunner-an-underrated-powerhouse-for-php-applications-46410b0abc)
- [Turbocharge for your PHP applications](https://davegebler.com/post/php/turbo-charge-your-php-applications-with-roadrunner)