- JavaScript Cloud Native Development Cookbook
- John Gilbert
- 256字
- 2021-07-16 18:03:34
How it works...
Cloud-native systems are architected to evolve. Over time, the functional requirements will change and the technology options will improve. However, some changes are not incremental and/or do not support an immediate switch from one implementation to another. In these cases, it is necessary to have multiple versions of the same functionality running simultaneously. If these services produce data, then it is necessary to synchronize data changes between the services. This bi-directional synchronization will produce an infinite messaging loop if an appropriate latching mechanism is not employed.
This recipe builds on the database-first variant of the Event Sourcing pattern. A user of service one invokes the command function. The command function opens the latch by setting the latch on the domain object to open. The trigger function's forLatchOpen filter will only allow publishing an event when the latch is open, because the open latch indicates that the change originated in service one. The listener function's forSourceNotSelf filter in service one ignores the event because the source tag indicates that the event originates from service one. The listener function in service two closes the latch before saving the data by setting the latch on the domain object to closed. The trigger function in service two does not publish an event, because the closed latch indicates that the change did not originate in service two.
This same flow unfolds when the command originates in service two. You can add a third and fourth service and more, and all the services will remain in sync.
- 雙/多基地雷達目標探測與識別
- EGPRS網(wǎng)絡(luò)演進
- 輕松電子制作
- 數(shù)據(jù)虛擬化:多源異構(gòu)數(shù)據(jù)集成之道
- 面向未來的光交換網(wǎng)絡(luò)及其器件技術(shù)
- iOS開發(fā)快速進階與實戰(zhàn)
- 有線數(shù)字電視網(wǎng)絡(luò)
- 通信專業(yè)綜合能力與實務:交換技術(shù)
- H3CNE實驗手冊
- 移動互聯(lián)網(wǎng)概論 第2版
- 鴻蒙第三方組件庫應用開發(fā)實戰(zhàn)
- 移動系統(tǒng)中間件建模與仿真
- 移動通信技術(shù)
- 電磁兼容設(shè)計與整改對策及案例分析
- 基于硬件邏輯加密的保密通信系統(tǒng)