Skip to navigation

Run mixed HTTP and Kafka collections

View as Markdown

A single collection run can mix Kafka steps with other collection types in one sequence, so you can assert on what a system actually did across protocols in one pass. For example, calling an HTTP endpoint that triggers an async side effect, then consuming a Kafka topic to confirm the event it should have produced actually arrived.

Step order in a mixed-protocol run

Each step in the run completes before the next one starts, in the order they appear in the collection. No two steps run concurrently or in parallel, so a Kafka consume step and an HTTP step can’t run at the same time within one run.

For example, a run like this:

  1. HTTP POST /orders → returns an order ID, stored as an environment variable.
  2. Kafka consume orders.created (bounded) → asserts an event for that order ID arrived within the bound.
  3. Kafka produce payments.completed → simulates the downstream payment service.
  4. HTTP GET /orders/{orderId} → asserts the order’s state is now "paid".
  5. Kafka consume notifications.sent (bounded) → asserts the notification fired.

Each step runs to completion before the run advances to the next step. For a Kafka consume step, that means waiting out its stopAfter bound (records, duration, idle timeout, or timestamp) before the run moves on. There’s no way to end a consume step from a script. See Bounded consume runs to its configured stop condition.

Pass variables across protocols

Because Kafka requests use the same variable scopes as HTTP requests, a script in one step can set a variable that a later step, of either protocol, reads:

  • An HTTP request’s script calls pm.environment.set("orderId", pm.response.json().orderId).
  • A later Kafka consume step’s Before consume or On message script can read it back with pm.environment.get("orderId"), or an HTTP or Kafka step further down the run can reference it directly as {{orderId}}.

See Cross-protocol variable passing for more on the scripting side of this.

Run in CI

The same mixed-protocol collection runs headlessly with the Postman CLI, so a run like the order, payment, and notification example earlier on this page can be a pull request gate rather than only a manual UI run. See Generate collection run reports using the Postman CLI for current reporter support across protocols.