> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hookstream.io/llms.txt
> Use this file to discover all available pages before exploring further.

# RabbitMQ

Publish events to RabbitMQ exchanges via the HTTP Management API.

The `rabbitmq` provider publishes events to a RabbitMQ exchange via the HTTP Management API's `/api/exchanges/{vhost}/{exchange}/publish` endpoint.

**When to use this**: you already run RabbitMQ and want webhooks to fan out through your existing exchanges and queues.

Cloudflare Workers can't speak AMQP — it needs raw TCP sockets. hookstream publishes via the RabbitMQ HTTP Management API instead, which means you must enable the management plugin and expose it over HTTPS. This is fine for most setups, but it's not the AMQP fast path you might be used to.

## Configuration

RabbitMQ Management API base URL (usually port `15672`), e.g. `https://rabbitmq.example.com:15672`. No trailing slash required.

Virtual host to publish into. URL-encoded automatically — use `/` for the default vhost.

Exchange name to publish to. The exchange must already exist.

Routing key applied to every published message.

RabbitMQ username with publish permissions.

RabbitMQ password. Stored encrypted and masked in `GET` responses.

## Authentication

**Basic auth**

hookstream uses HTTP Basic auth (`username:password`) on every publish request. Create a dedicated RabbitMQ user with only publish permissions on the target exchange:

    ```bash
    rabbitmqctl add_user hookstream <password>
    rabbitmqctl set_permissions -p / hookstream "" "^webhooks$" ""
    ```

    (The three regex args are configure/write/read — the example above allows writing only to the `webhooks` exchange.)

## Message Format

Each publish call looks like:

```json
{
  "properties": {
    "content_type": "application/json",
    "headers": {
      "hookstream-event-id": "evt_abc123",
      "hookstream-destination-id": "dest_xyz"
    }
  },
  "routing_key": "events",
  "payload": "{...webhook body as a string...}",
  "payload_encoding": "string"
}
```

Success requires both a `2xx` response **and** a response body of `{"routed": true}`. A `200 OK` with `{"routed": false}` is treated as a delivery failure so an unbound exchange won't silently swallow events.

## Example

```bash
curl -X POST https://hookstream.io/v1/destinations \
  -H "X-API-Key: $HOOKSTREAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Message Broker",
    "type": "rabbitmq",
    "config": {
      "url": "https://rabbitmq.example.com:15672",
      "vhost": "/",
      "exchange": "webhooks",
      "routing_key": "events",
      "username": "hookstream",
      "password": "secret"
    }
  }'
```

## Gotchas

**Enable the management plugin**

The Management API ships with RabbitMQ but isn't always enabled:

    ```bash
    rabbitmq-plugins enable rabbitmq_management
    ```

    The API listens on port `15672` by default.
  **Expose the Management API over HTTPS**

Don't put the Management API on the public internet without TLS. Use a reverse proxy (nginx, Caddy, Cloudflare Tunnel) or whitelist Cloudflare egress IPs at the firewall.
  **routed: false is a failure**

If your exchange has no matching binding, RabbitMQ returns `{"routed": false}`. hookstream treats this as a failure so it'll retry and eventually raise an issue — bind at least one queue before publishing.

## Next Steps

**[Kafka](/providers/kafka)**

Produce to Kafka topics via Confluent REST Proxy.
  **[HTTP / Webhook](/providers/http)**

Deliver straight to an HTTP endpoint instead.
  **[Circuit Breaker](/guides/circuit-breaker)**

How hookstream protects failing exchanges from being hammered.
  **[Destinations API](/api/destinations)**

Full API reference.