Bite-sized, standalone interview questions and answers for Messaging & Integration. Read 5-10 per sitting. Each answer is 2-4 sentences max and stands on its own.

35 questions shown. Filter by keyword or difficulty below.

Topic: Brokers & delivery semantics (Order 0)

A direct call is one service invoking another over the network and blocking for an answer, like gRPC. Messaging replaces “call and wait” with “write to a broker and move on” — the producer returns immediately and the broker holds the message until a consumer is ready. The win is decoupling; the cost is that you inherit delivery problems like duplicates, ordering, and stuck messages.

A broker is a standalone server that receives messages from producers and delivers them to consumers, holding them durably so neither side must be online at the same time. Producers and consumers only know the broker’s address, never each other’s. Apache Kafka and RabbitMQ are both brokers, just built around different delivery models.

At-least-once means a message is delivered one or more times — the broker resends until it sees an acknowledgement, so a crash before ack causes a duplicate. This is the default in both Kafka (offset committed after processing) and RabbitMQ (message requeued on nack). You must make consumers tolerate duplicates to be correct under this guarantee.

At-most-once delivers zero or one time and may drop a message on failure (achieved by auto-acking on receipt). At-least-once resends until acked, risking duplicates. Exactly-once applies an effect precisely once, usually via idempotent writes plus transactional offset/state commits, carrying real throughput cost — so it is reserved for cases where duplicates are genuinely unacceptable.

This is at-least-once delivery producing a duplicate after a crash before acknowledgement. The fix is an idempotent consumer that deduplicates on a message or business ID, so reprocessing the same order yields the same result (one shipment) instead of a second box.

Topic: Kafka partitions & consumer groups (Order 1)

A partition is an ordered, immutable sequence of records within a Kafka topic, each assigned a monotonically increasing offset. A topic is split into N partitions so it can be parallelized and scaled across brokers and consumers. Ordering is guaranteed only within a single partition, never across the whole topic.

A partition key is a value (often a field like order_id) hashed by the producer to decide which partition a record lands on, so records with the same key always go to the same partition and stay strictly ordered. Choosing a poorly distributed key creates hot partitions that a single consumer must shoulder alone.

Ordering is guaranteed only within a partition, and your key selected the wrong partition boundary. Because order_id events spread across different user_id partitions, they are processed out of sequence. Choose the partition key to match the ordering you actually need — partition by order_id, not user_id.

A consumer group is a named set of consumers that share the work of reading a topic, with each partition assigned to exactly one member of the group. Adding consumers scales throughput up to the partition count, after which extra consumers sit idle. Kafka tracks the group’s progress with a single committed offset per partition.

A consumer group scales up to the partition count — each partition is read by exactly one member, so extra consumers beyond that count sit idle. The design takeaway is to size the group to (but not beyond) the number of partitions, and to monitor consumer lag as the signal of whether consumers are keeping up.

Topic: RabbitMQ exchanges & routing (Order 2)

An exchange is the RabbitMQ entry point that receives published messages and decides, based on its type and the message’s routing key, which bound queues receive a copy. A producer never publishes directly to a queue; it always publishes to an exchange, which then routes via bindings.

A routing key is a short string attached to a message that the exchange matches against queue bindings to decide delivery. In a topic exchange it is dot-separated (e.g. order.created) and supports * and # wildcards in the binding pattern. It is the addressing mechanism that lets one exchange fan messages out to the right subset of queues.

A binding is the rule linking an exchange to a queue (optionally with a routing-key pattern) that tells the exchange when to route a message into that queue. Without a binding, a queue receives nothing even if it exists. Bindings are how you wire a topology: declare the exchange, declare the queue, then bind them with the keys you care about.

RabbitMQ uses per-message acknowledgement: a worker pulls a message, processes it, and acks it, at which point RabbitMQ deletes it — there is no replay once acked. Kafka uses per-partition offset commits after processing, and the log is durable so a consumer can rewind; the broker does not delete records on read.

Topic: Kafka vs RabbitMQ: pub/sub vs point-to-point (Order 3)

Use Kafka when many independent systems need the same event stream, when you need replay, or when throughput and ordering-per-key dominate. Use RabbitMQ when you need flexible routing, per-message ack, and a simple work-queue where each task is done exactly once by one worker. Real systems often run Kafka as the event backbone and RabbitMQ for task queues.

Pub/sub is the delivery model where one published message is copied to every subscriber’s queue or read position, so many independent consumers react to the same event — it broadcasts, not consumes once. Point-to-point delivers a message to exactly one receiver out of a pool of competing consumers, giving load balancing. RabbitMQ work-queues are point-to-point; Kafka consumer groups achieve the same effect per partition.

Pub/sub fits: one published “order placed” event is copied to every subscriber so fulfillment, analytics, and email all react independently. Broadcast (not consume-once) is exactly the point — a topic or fan-out target reaches multiple systems at once. Point-to-point would wrongly deliver it to only one consumer.

A topic is a named, append-only log or category of events that producers publish to and many consumers subscribe to independently; publishing to a topic does not know or care who is listening. In RabbitMQ the analogous fan-out target is a topic exchange plus bound queues. Both let many consumers react to the same category of message.

Topic: Poison messages & reliability (Order 4)

A malformed or always-failing message can be requeued forever, blocking a RabbitMQ queue, or be endlessly retried by a Kafka consumer, driving up lag. One bad record can stall healthy traffic if it is never moved aside. The fix is to route failures to a dead-letter queue after a retry budget.

A DLQ is a separate queue where messages are moved after repeated delivery failures or expiry so they stop poisoning the main pipeline. RabbitMQ routes to it on reject/nack-with-requeue-false or TTL; Kafka needs an outbox or a separate topic since the log has no built-in reject path. The DLQ lets you inspect, fix, and replay poison messages without blocking healthy traffic.

An idempotent consumer produces the same result whether a message is handled once or five times, typically by keying its write on a unique message or event ID. This is what makes at-least-once delivery safe in practice. Common tricks are a dedupe table of seen IDs or an upsert keyed on the natural business key.

You need backpressure and consumer-group scaling. Without backpressure or scaling the group up to the partition count, a brief slowdown becomes a long backlog — in Kafka this shows up as growing consumer lag, and in RabbitMQ as growing queues. Prefetch (QoS) limits unacked messages in RabbitMQ; scaling or producer throttling helps in Kafka.

Backpressure is the mechanism by which a slow or overloaded consumer signals or forces the producer/broker to slow down so the system does not buffer unbounded work and fall over. In Kafka it shows up as consumer lag and is managed by scaling the group or throttling producers; in RabbitMQ, prefetch (QoS) limits how many unacked messages a consumer holds. Without it, a brief slowdown cascades into memory exhaustion or data loss.

Topic: gRPC & realtime (Order 5)

gRPC is a high-performance RPC framework over HTTP/2 that uses Protobuf for strongly-typed request/response contracts, ideal for synchronous service-to-service calls. Unlike a broker, it is a direct, connection-oriented call where the client blocks for a response from one server. For synchronous request/response you reach for gRPC; brokers are for backend-to-backend integration, not direct user push.

SignalR is ASP.NET Core’s realtime library that pushes messages from server to connected browser clients over WebSockets, a server-initiated push channel — not a durable broker. A disconnected client misses messages unless you persist and replay them yourself. It is the right tool for live UI updates, whereas brokers handle reliable backend integration.

WebSocket is a full-duplex, long-lived TCP connection upgraded from HTTP that lets a server and client stream messages both ways without reopening a connection. It underpins SignalR and most realtime browser features, but it has no delivery guarantees, no replay, and no built-in routing. It is a transport, not a broker.

Topic: Events vs commands & serialization (Order 6)

An event is a fact that already happened (“order placed”) and is broadcast for anyone interested, while a command is a request for one receiver to do something (“send this email”). Events drive pub/sub and decoupling; commands drive point-to-point and explicit routing. Mixing them up — publishing a command as if it were an event — is a frequent source of double-processing bugs.

The command was published as if it were an event — commands are requests for one receiver and should use point-to-point routing (e.g., a RabbitMQ work-queue), not broadcast pub/sub. Broadcasting a command lets multiple consumers act on it, causing double-processing. Distinguish event (broadcast) from command (single receiver) before choosing the delivery model.

Serialization encodes a message’s structured data onto the wire, and a schema (Avro, Protobuf, JSON Schema) defines that structure so producers and consumers agree on the bytes. Avro and Protobuf are compact binary formats with enforced schemas and backward compatibility; JSON is human-readable but schema-optional and verbose. Kafka commonly pairs Protobuf/Avro with a Schema Registry so evolving a message does not break old consumers.

They solve different problems: Kafka is for high-throughput, replayable event streams consumed by many systems, while RabbitMQ is for routed, acked work items handled by one worker. The order example uses Kafka for the event backbone (order placed) and RabbitMQ for a task queue (send email). Running both matches each message to its natural delivery model rather than forcing one broker to do both poorly.

Topic: Exactly-once, outbox & schema evolution (Order 7)

Exactly-once means each message is processed exactly one time — no duplicates, no losses. In practice, no distributed system can guarantee this across the network (messages can be duplicated by the broker, the network, or the consumer). Kafka approximates it via idempotent producers (enable.idempotence=true) and transactional consumers (read_committed isolation), but this adds latency and limits throughput. Most systems settle for at-least-once delivery combined with idempotent consumers (deduplication on the consumer side) as a more practical tradeoff.

Kafka triggers a rebalance: partitions are redistributed among the remaining (or new) consumers in the group. During the rebalance, processing pauses briefly — no consumer processes the affected partitions. After rebalance, each consumer resumes from its last committed offset. If the consumer crashed mid-processing (before committing), the new owner re-processes those messages, causing duplicates. This is why at-least-once + idempotent consumers is the standard pattern.

The dual-write problem: you want to write to the database and publish an event to Kafka, but these are two separate operations that can’t be atomic without two-phase commit. The outbox pattern writes the event to an “outbox” table in the same database transaction as the business data. A separate process (CDC via Debezium, or a polling publisher) reads the outbox table and publishes events to Kafka. This guarantees at-least-once delivery without distributed transactions, because the event and the data are in the same transactional boundary.

A Schema Registry stores message schemas (Avro, Protobuf) and enforces compatibility rules when a producer registers a new version. It prevents a producer from publishing a message that breaks existing consumers — for example, removing a required field or changing a type. The producer fetches the schema ID, includes it in the message header, and the consumer uses it to deserialize. Without a registry, schema evolution is a manual coordination process between producer and consumer teams.

A DLQ accumulates messages that repeatedly failed processing (poison messages, malformed data, downstream dependency down). First, inspect the message to understand why it failed — check the original error, the message shape, and the consumer logs. If it’s a bug, fix the consumer and replay the DLQ. If it’s bad data, decide whether to fix the data, transform it, or discard it. Most systems need a DLQ replay mechanism (re-publish to the original topic after fixes) — without it, DLQ messages become permanently lost.


Last updated: July 2026 Total Q&A: 35 across Messaging & Integration

Back to Q&A Index