Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Looking back on a decade of message brokers in your company (JMS, then RabbitMQ, then Kafka), what lessons would you apply to the next messaging decision, and how would you reduce the cost of the next migration?

The main lessons are that broker choices often followed fashion rather than documented needs, that code calling broker APIs directly made every migration expensive, and that message contracts outlived every broker. For the next decision we would start from written use cases and measured requirements, keep messaging behind thin adapters that a team owns, treat schemas and delivery guarantees as the long-lived asset, plan the exit cost before adopting anything, and invest in operating skills, because most past incidents came from misuse rather than from the broker itself.

Why this question is asked

A company that has been through JMS, RabbitMQ and Kafka has paid for three migrations, and each one was more expensive than planned. A senior leader is expected to learn from that history so the fourth decision, whenever it comes, costs less. Interviewers ask this to hear reflection backed by reasons, not a list of regrets. In this answer, we will look at each lesson from the decade, explain why it happened and what it cost, and turn it into a practice we would apply next time, with a small example of the adapter idea in code.

1Lesson 1: Decisions Followed Fashion

Looking back honestly, each move had a story: JMS because it was the enterprise standard, RabbitMQ because it was lighter and open source, Kafka because everyone was moving to event streaming. Each was a reasonable tool, but the decision records, where they existed, described the new broker's strengths rather than our needs. Some workloads moved to Kafka that were really work queues, and teams then built retry and dead-letter handling by hand.

The practice for next time is to start from documented use cases and measured needs: volumes, latency targets, retention and replay needs, ordering, per-message retry, and the skills we have. We test candidate platforms against those numbers, for example a proof of concept at twice our peak throughput with our real message sizes, before choosing.

2Lesson 2: Broker APIs Were Everywhere

The biggest cost in each migration was not the new broker but finding and changing every place that used the old one. Business code called JmsTemplate, then RabbitTemplate, then KafkaTemplate directly, often deep inside services, with broker-specific headers and retry logic mixed in. A migration meant touching hundreds of classes and retesting them.

The practice is to keep messaging behind a thin adapter: a small interface in business terms, with one implementation per broker, owned by a team. Business code depends on the interface only.

Java
// Business code depends on this, not on any broker
public interface OrderEvents {
void orderPlaced(OrderPlaced event);
}
// One small adapter per broker, owned by the platform or service team
@Component
class KafkaOrderEvents implements OrderEvents {
private final KafkaTemplate<String, OrderPlaced> kafka;
KafkaOrderEvents(KafkaTemplate<String, OrderPlaced> kafka) { this.kafka = kafka; }
public void orderPlaced(OrderPlaced e) {
kafka.send("orders.placed.v1", e.orderId(), e); // key keeps one order's events in order
}
}
// moving brokers: write a new adapter, the business code is unchanged
Step throughWhere the broker sits in a service
  1. Business logicplain code, knows OrderEvents only
  2. PortOrderEvents interface in business terms
  3. AdapterKafkaOrderEvents, the only broker-aware class
  4. Client librarySpring Kafka, Spring AMQP, JMS
  5. Brokerthe part that changes every few years

5 layers, from the top down. Step through them one at a time.

Only the bottom three layers change when the broker does.

Notice that the adapter is thin on purpose. It does not try to hide every broker difference behind a universal API; that kind of abstraction tends to become a broker of its own. It just keeps the broker calls in one known place, so a migration changes a few adapters instead of every service.

3Lesson 3: Contracts Outlived Every Broker

When we migrated, the hardest part to get right was never the transport; it was meaning. What exactly does OrderPlaced contain, which fields are optional, may a consumer receive it twice, can events for one order arrive out of order? These answers were often implicit in the old broker's behaviour, and the migration broke them silently.

The practice is to treat contracts as the long-lived asset: schemas for each message kept in a registry or a shared repository, with compatibility rules, and written semantics for each topic or queue, including its delivery guarantee (at-least-once, so consumers must be idempotent) and its ordering scope (per order id, not global). A description format such as AsyncAPI can hold this in one document. With those written, a new broker is a new transport for the same contracts, and tests can check that the contract still holds after the move.

4Lesson 4: Nobody Planned the Exit

Every platform was adopted with an entry plan and no exit plan. When the time came to leave, we discovered stored messages that had to be drained or copied, proprietary features in use, and contracts that ran for years. The practice is to write the exit cost into the adoption decision: how would we leave, what data would need to move, which features would lock us in, and what would it roughly cost. A platform whose exit we cannot describe is a bigger commitment than it looks, and we decide on it knowing that.

5Lesson 5: Most Incidents Were Misuse

When we reviewed a decade of messaging incidents, few were caused by a broker bug. Most were misuse: unbounded queues that filled memory, consumers with auto-acknowledge losing messages on crash, giant messages, topics with thousands of partitions, missing dead-letter queues, no alerts on consumer lag. Each new broker brought its own ways to misuse it, and teams learned them in production.

The practice is to invest in operating skills as part of adoption: a platform team that knows the broker deeply, a short guide with safe defaults (acknowledgement mode, retries, dead-lettering, sizes), templates or starters that apply them, and dashboards for lag and queue depth from day one. This costs far less than the incidents it prevents.

6Follow-up questions

Isn't Spring Cloud Stream already the adapter you describe?

It is one form of it, and it helps for simple services. But it is a general abstraction with its own lifecycle; its annotation model was removed, which forced a migration of its own. A thin interface in business terms, implemented with whichever library suits, keeps the dependency small and under our control.

How do you get teams to write contracts when they are busy?

Make it the easy path: a schema registry or repository with templates, compatibility checks in CI that fail a build on a breaking change, and a review of new topics by the platform group. When the contract is the thing that gets a new topic approved, teams write it.

How do you measure whether the next migration is cheaper?

We record the effort of each migration, in engineer-months and number of services changed, and compare. With adapters in place, the number of classes touched per service should drop to a handful, which is a concrete target to check.

7Conclusion

In this answer, we turned a decade of broker changes into practices: decide from documented use cases and measured needs instead of fashion, keep broker APIs behind thin adapters owned by a team, treat schemas and delivery semantics as the long-lived asset, plan the exit cost before adoption, and invest in the operating skills that prevent misuse. Together, these make the next migration a change of transport rather than a rewrite.

What to say in the interviewAbout 90 seconds aloud

Open with

Looking back, the first lesson is that our choices followed fashion: JMS was the standard, RabbitMQ was lighter, Kafka was what everyone adopted, and the decision records described the broker rather than our needs.

Then, if they want more

Next time I'd start from written use cases and measured numbers like volume, retention, replay, ordering and retry needs, and test candidates against them. The second lesson is that migrations were expensive because business code called broker APIs everywhere.

I'd keep messaging behind thin adapters, a small interface in business terms with one implementation per broker, so a move means rewriting a few adapters rather than every service. The third is that contracts outlived every broker: what an event contains, whether it can arrive twice, and in what scope it's ordered.

Those are the real asset, so I'd keep schemas in a registry with compatibility checks and write down each topic's delivery and ordering guarantees. The fourth is that nobody planned the exit; I'd make the exit cost part of the adoption decision.

And the fifth is that most incidents came from misuse, like auto-acknowledge, unbounded queues or missing dead-letter queues, not from the brokers. So I'd invest in a platform team, safe defaults in starters and lag dashboards from day one. Together that turns the next migration into a change of transport.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
RabbitMQ documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Looking back on a decade of message brokers in your company (JMS, then RabbitMQ, then...": https://scrivio-interview-library.netlify.app/spring-boot/rabbitmq-and-jms/bc3f1ee3cd/