官术网_书友最值得收藏!

How it works...

In this recipe, we implement a command function called submit that would be part of a Backend For Frontend service. Following the Event Sourcing pattern, we make this command atomic by only writing to a single resource. In some scenarios, such as initiating a long-lived business process or tracking user clicks, we only need to fire-and-forget. In these cases, the event-first variant is most appropriate. The command just needs to execute quickly and leave as little to chance as possible. We write the event to the highly available, fully-managed cloud-native event stream and trust that the downstream services will eventually consume the event.

The logic wraps the domain object in the standard event format, as discussed in the Creating an event stream and publishing an event recipe in Chapter 1Getting Started with Cloud-Native. The event type is specified, the domain object ID is used as the partitionKey, and useful tags are adorned. Finally, the event is written to the stream specified by the STREAM_NAME environment variable.

主站蜘蛛池模板: 泾阳县| 洛浦县| 于都县| 密云县| 平塘县| 邵阳县| 剑河县| 琼海市| 周口市| 包头市| 项城市| 尼木县| 建瓯市| 临洮县| 若羌县| 湄潭县| 新蔡县| 碌曲县| 卫辉市| 泸定县| 靖州| 林口县| 化州市| 栾川县| 德庆县| 岢岚县| 荣成市| 昔阳县| 桐柏县| 集安市| 桃江县| 望谟县| 宣汉县| 亳州市| 大庆市| 云和县| 五台县| 略阳县| 百色市| 芜湖县| 肇州县|