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

# Send Kafka and RabbitMQ Messages with Message Dispatch

> Use Devset's Postman-style Message Dispatch tool to compose, send, and save individual Kafka or RabbitMQ messages from your browser.

Message Dispatch is Devset's built-in request tool for sending individual messages to a Kafka topic or a RabbitMQ queue or exchange. Think of it as a Postman-style client purpose-built for event brokers — you compose a payload, attach a schema for validation or encoding, and fire it off against any configured connector. Open Message Dispatch at [http://localhost:8082/message-dispatch](http://localhost:8082/message-dispatch).

## Sending a Message

<Steps>
  <Step title="Select a connector">
    At the top of the request card, open the **Connector** dropdown and choose the Kafka or RabbitMQ connector you want to send through. Connectors are the named broker connections configured in your Devset instance.
  </Step>

  <Step title="Set the target">
    Enter the destination for your message. The fields shown depend on the broker type:

    <Tabs>
      <Tab title="Kafka">
        Enter the **Topic** name you want to publish to.

        Optionally configure:

        * **Key** — the Kafka message key used for partition routing.
        * **Headers** — additional key-value metadata attached to the message envelope.
      </Tab>

      <Tab title="RabbitMQ">
        Enter the **Exchange** name and the **Routing Key** used to route the message to the correct queue binding.

        If you are publishing directly to a queue, leave the exchange blank and enter the queue name as the routing key.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Compose the payload">
    Write your message payload in the **Payload Editor**. You can switch between two modes:

    * **Raw JSON** — type or paste a JSON object directly.
    * **Function Studio** — use dynamic field expressions (see the [Flow Builder guide](/guides/flow-builder) for an overview of expression modes such as `FN`, `REF`, and `WHEN`).

    Here is an example raw JSON payload:

    ```json theme={null}
    {
      "orderId": "ord-8821",
      "customerId": "cust-0042",
      "items": [
        { "sku": "WIDGET-A", "qty": 3 },
        { "sku": "WIDGET-B", "qty": 1 }
      ],
      "total": 149.99,
      "currency": "USD"
    }
    ```
  </Step>

  <Step title="Attach a schema (optional)">
    In the **Schema** section of the request card, select a schema ID from the Schema Repo. Devset uses the schema to validate JSON payloads before sending, or to encode Protobuf payloads into binary wire format. Configure **Wire Format** settings if you are using Protobuf.
  </Step>

  <Step title="Send the message">
    Click **Send**. Devset dispatches the message to the broker through the selected connector. The result appears in the **History** panel.
  </Step>
</Steps>

## Organizing Requests with Collections

Collections are named groups of saved requests. They let you organize related messages — for example, all messages related to an order lifecycle — and re-send them quickly without re-filling the form.

<Steps>
  <Step title="Save a request">
    After composing a request, click **Save**. The save modal prompts you for a name and a collection. Choose an existing collection or type a new name to create one.
  </Step>

  <Step title="Open a saved request">
    In the **Collections** panel on the left, expand a collection and click any saved request to load it back into the request card.
  </Step>

  <Step title="Re-send or modify">
    Adjust any fields as needed and click **Send** again. Saving again overwrites the existing entry or creates a new one depending on your choice in the save modal.
  </Step>
</Steps>

<Tip>
  Use collections to build a library of test fixtures for each of your event schemas. Pair them with the Schema Repo so every request has a schema attached and payload validation runs automatically before dispatch.
</Tip>

## Attaching a Schema for Validation and Encoding

The Schema section of the request card connects a dispatch request to a definition in the [Schema Repo](/guides/schema-repo).

* **JSON Schema** — Devset validates the payload structure before sending. Validation errors surface inline in the payload editor.
* **Protobuf** — Devset encodes the JSON object into binary Protobuf format using the linked `.proto` definition before placing the message on the broker. Configure the **Wire Format** options to match your consumer's expectations.

Select the schema from the dropdown in the Schema section. The schema ID displayed here matches the `schemaId` you assigned when creating the schema in the Schema Repo.

## Reviewing Past Dispatches

The **History** panel on the right side of the screen logs every message you have sent in the current session. Each entry shows the connector, target, and a timestamp.

Click any history entry to open a **preview modal** showing the full request details — connector, target, headers, and the exact payload that was sent. This is useful for confirming what was dispatched and for debugging unexpected broker behavior.

<Note>
  History is session-scoped. Refreshing the page clears the history panel. Save any requests you want to keep to a collection before closing the tab.
</Note>
