Start building

Messaging and events

Kafka event → validate → publish

Consume a fixture record, parse and validate its JSON, publish a normalized event and explicitly commit the consumed record.

  • Kafka → Kafka
  • Intermediate
  • 5 min

Last verified 2026-10-31 at f4ce7d0 — simulation fixtures

Try this template in Studio

Studio activation is a one-time payment of USD 20.

Flow

Drawn at build time from the node positions in the template's process definitions. Numbered markers are the walkthrough stages.

Main processKafka · event normalization7 activities

Scroll sideways to see the whole flow.

Flow diagram of Kafka · event normalization7 activities and 6 transitions: Start, Consume order event, Parse JSON, Validate event, Publish normalized event, Commit offset, End.StartstartConsume order eventkafka.consume1Parse JSONjson.parseValidate eventjson.validate2Publish normalizedeventkafka.publish3Commit offsetkafka.commit4Endend
List the 7 activities and 6 transitions

Activities

  1. Start start
  2. Consume order event kafka.consume
  3. Parse JSON json.parse
  4. Validate event json.validate
  5. Publish normalized event kafka.publish
  6. Commit offset kafka.commit
  7. End end

Transitions

  • Start → Consume order event (on success)
  • Consume order event → Parse JSON (on success)
  • Parse JSON → Validate event (on success)
  • Validate event → Publish normalized event (on success)
  • Publish normalized event → Commit offset (on success)
  • Commit offset → End (on success)

Walkthrough

  1. Consume a recordThe in-memory fixture acts as an incoming raw event.
  2. Validate event JSONEnforce an ID and a non-negative numeric total.
  3. Publish normalized dataInspect the producer body and key in the trace.
  4. Commit after successExplicitly commit the consumed receipt.

What you will practise

  • Track consume, publish and commit as separate activities.
  • Test that invalid data does not reach publication or commit.

Sample cases

2 cases with 9 assertions, run with python -m server.integration examples --all in simulation.

Valid event

Passed

A valid order event is published and committed.

Expected result A simulated send result and no uncommitted receipt.

4/4 assertions

  • Process completes in simulation
  • Publisher reports a simulated send
  • Commit executed
  • No unconfirmed message remains

This sample run only; not a production certification.

Invalid event total

Expected failure verified

A negative total is rejected by JSON Schema.

Expected result Validation fails; publication and commit are skipped, leaving one unconfirmed receipt.

5/5 assertions

  • Expected failure is recorded
  • Schema rejection is visible
  • No event is published
  • No offset is committed
  • Failed message remains unconfirmed

This sample run only; not a production certification.

Prerequisites

Runtime
Cohuno runtime 1.27.0, the version recorded when these cases last passed.
Starter
Manual start; no listener.
Optional dependencies
  • The optional Kafka driver (requirements-kafka.txt) needed only for live connections; simulation uses fixtures
Selected for this closure by the same rules as runtime packaging.
Simulation fixtures
  • demo_kafka kafka · kafka.consume, kafka.publish, kafka.commit
Every sample run replaces these connections with the fixtures defined in its case. A live run needs an operator to configure an authorized connection for each.
Verification details

Provenance

What was verified, and when. The content part changes whenever the pack, a process in its closure, the runtime version or a case result changes; the gallery check then fails until the gallery is regenerated and the changed templates are verified again.

Verified content

Pack SHA-256
0d3e7c07292f4a44484c9c743ddb1724d57db4b18f6641e3b7d045e19d4d8e88
Closure SHA-256
23a28591e8d79d7af9caa67e36616937de09244a21308b1cd0f01b6959f56572
Runtime
1.27.0
Results
2/2 cases, 9/9 assertions, mode simulate, external calls: none.
Files in the closure
  • server/integration/example_packs/kafka_events.json
  • server/integration/templates/kafka_order_pipeline.json

Verification event

Commit
f4ce7d08eedc90267b405ed1974344153a8b3a34
Verified at (UTC)
2026-10-31T21:19:21Z

How the Cohuno team reproduces this check

PYTHONPATH=. python -m server.integration examples --example kafka_events
PYTHONPATH=. python scripts/export_public_gallery.py --check