This pattern is part of "Patterns of Legacy Displacement"

Event Interception

Intercept any updates to system state and route some of them to a new component

This page is a stub. We intend to fully expand it in later revisions of this material. However we are still in the middle of developing these patterns, so it's likely that patterns will be renamed, split, or merged as we continue to learn how best to frame and explain these ideas.

During displacement, both the legacy system and its replacement need to handle updates, often from upstream systems that can't easily be modified to use the new system. As displacement proceeds the replacement will gradually handle more of these updates, so we need a mechanism that can allow the new system to handle any updates it can, while leaving remaining updates to the legacy system.

With Event Interception, we identify events that cause the legacy system to perform updates. We then introduce an interceptor into the event's path. From the caller's perspective, nothing changes, they still invoke the legacy system through its now-intercepted end-point, so there is no need to identify or modify the callers. Initially the interceptors will just forward events to the legacy system unchanged, but as displacement continues we modify the interceptors to route more events to the new system, until the old system no longer handles any updates.