Occasion Interception


By the point adjustments have made their approach to the legacy database, then you could possibly argue that it’s too late for
occasion interception.
That mentioned, “Pre-commit” triggers can be utilized to intercept a database write occasion and take completely different actions.
For instance a row could possibly be inserted right into a separate Occasions desk to be learn/processed by a brand new element –
while continuing with the write as earlier than (or aborting it).
Word that vital care needs to be taken should you change the prevailing write behaviour as you could be breaking
an important implicit contract.

Case Examine: Incremental area extraction

Considered one of our groups was working for a consumer whose legacy system had stability points and had turn into troublesome to keep up and sluggish to replace.

The organisation was trying to treatment this, and it had been determined that probably the most applicable means ahead for them was to displace the legacy system with capabilities realised by a Service Based mostly Structure.

The technique that the workforce adopted was to make use of the Strangler Fig sample and extract domains, one by one, till there was little to not one of the unique utility left.
Different concerns that have been in play included:

  • The necessity to proceed to make use of the legacy system with out interruption
  • The necessity to proceed to permit upkeep and enhancement to the legacy system (although minimising adjustments to domains being extracted was allowed)
  • Modifications to the legacy utility have been to be minimised – there was an acute scarcity of retained data of the legacy system

Legacy state

The diagram under reveals the structure of the legacy
structure. The monolithic system’s
structure was primarily Presentation-Area-Information Layers.

Stage 1 – Darkish launch service(s) for a single area

Firstly the workforce created a set of companies for a single enterprise area together with the potential for the info
uncovered by these companies to remain in sync with the legacy system.

The companies used Darkish Launching – i.e. not utilized by any customers, as a substitute the companies allowed the workforce to
validate that knowledge migration and synchronisation achieved 100% parity with the legacy datastore.
The place there have been points with reconciliation checks, the workforce may purpose about, and repair them making certain
consistency was achieved – with out enterprise impression.

The migration of historic knowledge was achieved via a “single shot” knowledge migration course of. While not strictly Occasion Interception, the continuing
synchronisation was achieved utilizing a Change Information Seize (CDC) course of.

Stage 2 – Intercept all reads and redirect to the brand new service(s)

For stage 2 the workforce up to date the legacy Persistence Layer to intercept and redirect all of the learn operations (for this area) to
retrieve the info from the brand new area service(s). Write operations nonetheless utilised the legacy knowledge retailer. That is
and instance of Department by Abstraction – the interface of the Persistence Layer stays unchanged and a brand new underlying implementation
put in place.

Stage 3 – Intercept all writes and redirect to the brand new service(s)

At stage 3 a lot of adjustments occurred. Write operations (for the area) have been intercepted and redirected to create/replace/take away
knowledge inside the new area service(s).

This variation made the brand new area service the System of Document for this knowledge, because the legacy knowledge retailer was now not up to date.
Any downstream utilization of that knowledge, comparable to stories, additionally needed to be migrated to turn into a part of or use the brand new
area service.

Stage 4 – Migrate area enterprise guidelines / logic to the brand new service(s)

At stage 4 enterprise logic was migrated into the brand new area companies (reworking them from anemic “knowledge companies”
into true enterprise companies). The entrance finish remained unchanged, and was now utilizing a legacy facade which
redirected implementation to the brand new area service(s).

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *