[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eEvent-driven architecture is a software design pattern where microservices react to state changes, or events, which can carry data or be identifiers.\u003c/p\u003e\n"],["\u003cp\u003eIn an event-driven system, events are generated by producers, routed by an event router, and consumed by event consumers, all of which are decoupled and can be scaled independently.\u003c/p\u003e\n"],["\u003cp\u003eEvent-driven architectures are useful for monitoring changes, fanning out events to multiple consumers, enabling interoperability between technologies, and coordinating teams across different regions.\u003c/p\u003e\n"],["\u003cp\u003eBenefits of this architecture include loose coupling, asynchronous eventing, push-based messaging, real-time analysis, simplified auditing, and event sourcing.\u003c/p\u003e\n"],["\u003cp\u003eWhen implementing an event-driven system, considerations should be given to reliable event sources, handling asynchronous requests, event flow tracking, and data deduplication and ordering.\u003c/p\u003e\n"]]],[],null,["# Event-driven architectures\n\n[Advanced](/eventarc/advanced/docs/overview) [Standard](/eventarc/standard/docs/overview)\n\nAn *event-driven architecture* is a software design pattern in which\nmicroservices react to changes in state, called *events*. Events can either\ncarry a state (such as the price of an item or a delivery address) or events can\nbe identifiers (a notification that an order was received or shipped, for\nexample). The events trigger microservices that work together to achieve a\ncommon goal, but don't have to know anything about each other except the event\nformat. Although operating together, each microservice can apply a different\nbusiness logic, and emit its own output events.\n\nAn event has the following characteristics:\n\n- It is a record of something that has happened.\n- It captures an immutable fact that cannot be changed or deleted.\n- It occurs whether or not a service applies any logic upon consuming it.\n- It can be persisted indefinitely, at a large scale, and consumed as many times as necessary.\n\nIn an event-driven system, events are generated by **event producers** , ingested\nand filtered by an **event router** (or broker), and then fanned out to the\nappropriate **event consumers** (or sinks). The events are forwarded to the\nconsumers based on subscriptions defined by one or more matching *enrollments*\n(when using [Eventarc Advanced](/eventarc/advanced/docs/overview)) or\none or more matching *triggers* (when using\n[Eventarc Standard](/eventarc/standard/docs/overview)). These three\ncomponents---event producers, event router, event consumers---are decoupled and can\nbe independently deployed, updated, and scaled:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThe event router links the different services and is the medium through which\nmessages are sent and received. It executes a response to the original event\ngenerated by an event producer and sends this response downstream to the\nappropriate consumers. Events are handled asynchronously and their outcomes are\ndecided when a service reacts to an event or is impacted by it, as in the\nfollowing diagram of a very simplified event flow:\n\n\u003cbr /\u003e\n\nWhen to use event-driven architectures\n--------------------------------------\n\nConsider the following usages when designing your system.\n\n- **To monitor and receive alerts** for any anomalies or changes to storage buckets, database tables, virtual machines, or other resources.\n- **To fan out a single event** to multiple consumers. The event router will push the event to all the appropriate consumers, without you having to write customized code. Each service can then process the event in parallel, yet differently.\n- **To provide interoperability between different technology stacks** while maintaining the independence of each stack.\n- **To coordinate systems and teams** operating in and deploying across different regions and accounts. You can reorganize the ownership of microservices. There are fewer cross-team dependencies and you can react more quickly to changes that would otherwise be impeded by barriers to data access.\n\nBenefits of event-driven architectures\n--------------------------------------\n\nThese are some of the advantages when building an event-driven architecture.\n\n### Loose coupling and improved developer agility\n\nEvent producers are logically separated from event consumers. This\ndecoupling between the production and consumption of events means that services\nare interoperable but can be scaled, updated, and deployed independently of each\nother.\n\nLoose coupling reduces dependencies and lets you implement services in\ndifferent languages and frameworks. You can add or remove event producers and\nreceivers without having to change the logic in any one service. You don't need\nto write custom code to poll, filter, and route events.\n\n### Asynchronous eventing and resiliency\n\nIn an event-driven system, events are generated asynchronously, and can be\nissued as they happen without waiting for a response. Loosely coupled components\nmeans that if one service fails, the others are unaffected. If necessary, you\ncan log events so that the receiving service can resume from the point of\nfailure, or replay past events.\n\n### Push-based messaging, real-time event streams, and lower costs\n\nEvent-driven systems allow for push-based messaging and clients can receive\nupdates without needing to continuously poll remote services for state changes.\nThese pushed messages can be used for on-the-fly data processing and\ntransformation, and real-time analysis. Moreover, with less polling, there is a\nreduction in network I/O, and decreased costs.\n\n### Simplified auditing and event sourcing\n\nThe centralized location of the event router simplifies auditing, and lets you\ncontrol who can interact with a router, and which users and resources have\naccess to your data. You can also encrypt your data both in transit and at rest.\n\nAdditionally, you can make use of event sourcing, an architectural pattern that records\nall changes made to an application's state, in the same sequence that they were\noriginally applied. Event sourcing provides a log of immutable events which can\nbe kept for auditing purposes, to recreate historic states, or as a canonical\nnarrative to explain a business-driven decision.\n\nArchitectural considerations\n----------------------------\n\nAn event-driven architecture might require that you approach your application\ndesign in a new way. Although well suited for applications that make use of\nmicroservices or decoupled components, you should also consider the following:\n\n- *Can your event source guarantee delivery if you need to process every single\n event?*\n\n It should be a durable and reliable event source.\n- *Can your application handle multiple asynchronous requests?*\n\n Your system performance shouldn't rely on global scope or inelastic databases.\n- *How do you want to track your event flow?*\n\n An event-driven architecture supports dynamic tracking using monitoring\n services, but not static tracking using code analysis.\n- *Do you want to use the data in your event source to rebuild state?*\n\n You should consider how to ensure that your data is deduplicated and ordered.\n\nWhat's next\n-----------\n\n- To understand how Eventarc Advanced handles events, see the [Eventarc Advanced overview](/eventarc/advanced/docs/overview).\n- To understand how Eventarc Standard handles events, see the [Eventarc Standard overview](/eventarc/standard/docs/overview)."]]