I shall say this only once. And you shall do it only once. Exactly once. That’s a very common assumption for most of business software. One trigger equals one outcome. As it turns out, it is easier said than done.
Szymon Pobiega explains why duplicate messages are a fact of life in distributed systems (and why no infrastructure can help you). Fortunately, Szymon also shares tips on how to deal with nasty duplicate zombie messages.
One way to solve the problem is to prevent messages from getting duplicated in the first place. This requires transactions spanning data stores and messaging systems, which is neither fast nor widely available. Another way is taking advantage of natural idempotency of some operations (e.g., adding an item to a set). But let’s face it, most business code is more complex than that. A third option is the outbox pattern, which makes distributed transaction look like a rusty old timer.
Join Szymon to ensure you’ll never refund a customer twice again.
Szymon Pobiega is an engineer at Particular Software, where he is focused in particular (pun intended) on message routing patterns and handling of failures. Szymon worked on business software for almost a decade. Of all the ideas and petterns he learned along the way, messaging had the most profound impact. He built his first microservice system with MSMQ and NServiceBus 1.9 some nine years ago, which was a life-changing experience. Today, he hopes to use his field experience to make NServiceBus even better. In his freetime, he enjoys building remotely controlled vehicles with Legos.
©2018, O’Reilly UK Ltd • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • email@example.com