{"id":19992833,"url":"https://github.com/sheng-jie/EventBus","last_synced_at":"2025-05-04T12:30:27.247Z","repository":{"id":119681137,"uuid":"93586282","full_name":"sheng-jie/EventBus","owner":"sheng-jie","description":"C# 事件总线实现","archived":false,"fork":false,"pushed_at":"2018-01-08T07:28:17.000Z","size":63,"stargazers_count":160,"open_issues_count":2,"forks_count":70,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-13T04:55:43.500Z","etag":null,"topics":["csharp","eventbus","observer-pattern","publisher-subscriber"],"latest_commit_sha":null,"homepage":"http://www.jianshu.com/p/22fbe7a7c120","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sheng-jie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-07T03:00:12.000Z","updated_at":"2024-11-08T08:00:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb0a744c-3cd3-4492-bfe1-eba1038ad80a","html_url":"https://github.com/sheng-jie/EventBus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheng-jie%2FEventBus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheng-jie%2FEventBus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheng-jie%2FEventBus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheng-jie%2FEventBus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheng-jie","download_url":"https://codeload.github.com/sheng-jie/EventBus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252333946,"owners_count":21731301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","eventbus","observer-pattern","publisher-subscriber"],"created_at":"2024-11-13T04:52:20.657Z","updated_at":"2025-05-04T12:30:27.232Z","avatar_url":"https://github.com/sheng-jie.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"\n\n# 1. 简单介绍\n事件总线这个概念对你来说可能很陌生，但提到观察者（发布-订阅）模式，你也许就很熟悉。事件总线是对发布-订阅模式的一种实现。它是一种集中式事件处理机制，允许不同的组件之间进行彼此通信而又不需要相互依赖，达到一种解耦的目的。\n\n我们来看看事件总线的处理流程：\n\n![图1：EventBus流程](http://upload-images.jianshu.io/upload_images/2799767-6f44bdefa88a23a2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\n\nEvent Bus就相当于一个介于Publisher和Subscriber中间的桥梁。它隔离了Publlisher和Subscriber之间的直接依赖，接管了所有事件的发布和订阅逻辑，并负责事件的中转。\n\n# 2.实现原理\n1. [事件总线知多少（1）](http://www.jianshu.com/p/22fbe7a7c120)\n2. [事件总线知多少（2）](http://www.jianshu.com/p/61042d36b010)\n\n\n# 3.事件总线的实现要点\n1. 事件总线维护一个事件源与事件处理的映射字典；\n2. 通过单例模式，确保事件总线的唯一入口；\n3. 利用反射或依赖注入完成事件源与事件处理的初始化绑定；\n4. 提供统一的事件注册、取消注册和触发接口。\n\n# 4.集成消息队列\n计划开发中。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheng-jie%2FEventBus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheng-jie%2FEventBus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheng-jie%2FEventBus/lists"}