{"id":22326425,"url":"https://github.com/nimaara/easy.messagehub","last_synced_at":"2025-05-16T10:06:14.412Z","repository":{"id":46868887,"uuid":"51266022","full_name":"NimaAra/Easy.MessageHub","owner":"NimaAra","description":"No need for .NET Events! A thread-safe, high performance \u0026 easy to use cross platform implementation of the Event Aggregator Pattern.","archived":false,"fork":false,"pushed_at":"2024-09-22T16:42:07.000Z","size":1814,"stargazers_count":262,"open_issues_count":0,"forks_count":41,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-16T10:05:41.379Z","etag":null,"topics":["cross-platform","csharp","dotnet","dotnet-core","easy","easy-to-use","event-aggregation","messagebus","messagehub","messaging","performance"],"latest_commit_sha":null,"homepage":"","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/NimaAra.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":"2016-02-07T20:58:33.000Z","updated_at":"2025-05-07T20:12:24.000Z","dependencies_parsed_at":"2024-12-11T03:00:25.131Z","dependency_job_id":"03308c56-45bc-4982-bdb3-5ad122a4e073","html_url":"https://github.com/NimaAra/Easy.MessageHub","commit_stats":{"total_commits":46,"total_committers":3,"mean_commits":"15.333333333333334","dds":0.4130434782608695,"last_synced_commit":"f1b9c505e441b698afae1baf2cc3abc924e7a8e2"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimaAra%2FEasy.MessageHub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimaAra%2FEasy.MessageHub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimaAra%2FEasy.MessageHub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimaAra%2FEasy.MessageHub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NimaAra","download_url":"https://codeload.github.com/NimaAra/Easy.MessageHub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"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":["cross-platform","csharp","dotnet","dotnet-core","easy","easy-to-use","event-aggregation","messagebus","messagehub","messaging","performance"],"created_at":"2024-12-04T02:17:37.295Z","updated_at":"2025-05-16T10:06:14.395Z","avatar_url":"https://github.com/NimaAra.png","language":"C#","funding_links":["https://www.buymeacoffee.com/sP0BhM9n6"],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/Easy.MessageHub.svg)](https://www.nuget.org/packages/Easy.MessageHub) [![Build status](https://ci.appveyor.com/api/projects/status/64mfpw9w8lr7dt0j?svg=true)](https://ci.appveyor.com/project/NimaAra/easy-messagehub)\n\n# Easy.MessageHub\nAn implementation of the Event Aggregator Pattern.\n\nSupports _.Net Core_ (_.Net 4.5_ \u0026 _netstandard1.0_) running on:\n* .Net Core\n* .Net Framework 4.5 and above\n* Mono \u0026 Xamarin\n* UWP\n* Windows 8.0\n* Windows Phone 8.1\n* Windows Phone Seilverlight 8.0\n\n##### If you enjoy what I build then please \u003ca href=\"https://www.buymeacoffee.com/sP0BhM9n6\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" width=\"120px\" \u003e\u003c/a\u003e :-)\n___\n\n\n### Usage example:\n\nStart by creating an instance of the hub:\n```csharp\nIMessageHub hub = new MessageHub();\n```\n\nYou can now use the hub to subscribe to any publication of a given type:\n```csharp\nGuid token = hub.Subscribe\u003cPerson\u003e(p =\u003e Console.WriteLine($\"Id is: {p.Id}\"));\n// or    \nAction\u003cstring\u003e action = message =\u003e Console.WriteLine($\"Message is: {message}\");\nGuid anotherToken = hub.Subscribe(action);\n```\nYou can then use the token to do:\n\n```csharp\nhub.IsSubscribed(token); // returns true\nhub.Unsubscribe(token);\nhub.IsSubscribed(token); // returns false\n```\nOr you can clear all subscriptions by:\n```csharp\nhub.ClearSubscriptions();\n```\nPublication is as easy as:\n\n```csharp\nhub.Publish(new Person { Id = \"Foo\" });\nhub.Publish(\"An important message\");\n```\n\n#### Error handling:\nThe hub catches any exception thrown at the time of publication and exposes them via:\n```csharp\nhub.RegisterGlobalErrorHandler((token, e) =\u003e Console.WriteLine($\"Error Publishing, Token: {token} | Exception: {e}\"));\n```\n\n#### Global handler:\nThe hub allows the registration of a single handler which will receive every message published by the hub. This can be useful in scenarios where every message published should be logged or audited.\n\n```csharp\nhub.RegisterGlobalHandler((type, eventObject) =\u003e Console.WriteLine($\"Type: {type} - Event: {eventObject}\"));\n```\n\n#### Event throttling:\nThe hub allows each subscriber to throttle the rate at which it receives the events:\n\n```csharp\nhub.Subscribe\u003cstring\u003e(msg =\u003e Console.WriteLine($\"Message is: {msg}\"), TimeSpan.FromSeconds(1));\n```\nIn the above example, if the subscriber receives more than one message within _1_ second of another, it drops them.\n\n#### Inheritance support:\nThe hub supports inheritance by allowing to subscribe to a base class or an interface and receiving all the publications of types that inherit or implement the subscribed type. For example, given:\n\n```csharp\npublic class Order {}\npublic class NewOrder : Order{}\npublic class BigOrder : Order{}\n```\n\nA subscriber registering against `Ordrer` will also receive events of type `NewOrder` and `BigOrder`.\n#### More details [HERE](http://www.nimaara.com/2016/02/14/cleaner-pub-sub-using-the-event-aggregator-pattern/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimaara%2Feasy.messagehub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimaara%2Feasy.messagehub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimaara%2Feasy.messagehub/lists"}