Skip to main content
Back to Dev generators

Dev

Mock RabbitMQ Message Generator

When building or testing a RabbitMQ consumer, you need realistic message fixtures — not just a bare payload, but the full envelope that includes routing metadata. Without that, your consumer tests miss the exchange, routing key, and properties your real code depends on. This tool generates a single RabbitMQ-style message as a JSON object with no inputs required. The generated message includes exchange (one of events, orders, or notifications), routing_key (one of five event patterns: order.created, user.registered, payment.failed, email.queued, job.completed), a properties block with message_id (random 16-char hex), content_type, delivery_mode (2, meaning persistent), and a Unix timestamp — and a payload object with an id, type (matching the routing key), and a status of ok, pending, or retry. Copy the JSON into a test case, feed it to a mock consumer, or paste it into consumer logic to see how it parses the envelope. Adapt the exchange, routing key, and payload schema to your own system.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Click Generate to produce a queue message.
  2. Copy the JSON into a test or mock queue.
  3. Use it to exercise a consumer.
  4. Adapt the routing and payload to your system.

Use Cases

  • Testing a message consumer
  • Building a mock queue
  • Learning message-queue structure
  • Seeding sample messages
  • Demoing async messaging

Tips

  • Messages carry routing metadata.
  • The routing key directs delivery.
  • delivery_mode 2 means persistent.
  • Adapt the payload to your system.

FAQ

what fields does the generated message contain

The top level has exchange, routing_key, and properties (with message_id, content_type, delivery_mode: 2, and a timestamp), plus a payload object with id, type (matching the routing key), and status. All ids and values are randomly generated.

what does delivery_mode 2 mean

A delivery_mode of 2 marks the message as persistent, meaning RabbitMQ will write it to disk so it survives a broker restart. A value of 1 means transient — the message lives only in memory. For anything that must not be lost (orders, payments), persistent mode is the right choice.

what is a routing key and how does it work

A routing key is a label on a message (like order.created) that a RabbitMQ exchange uses to decide which bound queues should receive it. Topic exchanges support wildcard patterns (order.* or #.failed), letting consumers subscribe to subsets of events. The generated keys follow the dotted-noun-verb pattern common in practice.

can I use this to test a real rabbitmq consumer

You can use the JSON structure to build test fixtures or mock the message object your consumer receives. The format mirrors the envelope metadata a real broker attaches, so your consumer parsing and routing logic can be exercised. For full integration testing, publish the message through a real broker in a test environment.

You might also like

Popular tools from other categories that share themes with this one.

Try these next

More free tools from other corners of the catalog, picked by shared themes.