{"id":17008888,"url":"https://github.com/i-e-b/sevendigital.messaging","last_synced_at":"2025-04-12T07:40:30.334Z","repository":{"id":5825636,"uuid":"7041128","full_name":"i-e-b/SevenDigital.Messaging","owner":"i-e-b","description":"A distributed broadcast/subscribe event framework based on BearBones-Messaging","archived":false,"fork":false,"pushed_at":"2014-01-09T13:38:51.000Z","size":99093,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T02:51:10.955Z","etag":null,"topics":["c-sharp","event-driven","events","messaging","microservices","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i-e-b.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}},"created_at":"2012-12-06T18:59:01.000Z","updated_at":"2023-09-08T15:06:32.000Z","dependencies_parsed_at":"2022-09-13T02:10:31.881Z","dependency_job_id":null,"html_url":"https://github.com/i-e-b/SevenDigital.Messaging","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/i-e-b%2FSevenDigital.Messaging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FSevenDigital.Messaging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FSevenDigital.Messaging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FSevenDigital.Messaging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i-e-b","download_url":"https://codeload.github.com/i-e-b/SevenDigital.Messaging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248536604,"owners_count":21120682,"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":["c-sharp","event-driven","events","messaging","microservices","rabbitmq"],"created_at":"2024-10-14T05:29:28.695Z","updated_at":"2025-04-12T07:40:30.306Z","avatar_url":"https://github.com/i-e-b.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"SevenDigital.Messaging\r\n======================\r\nA distributed contracts-based sender/handler messaging system built on RabbitMQ and BearBones-Messaging\r\n\r\nInstallation\r\n------------\r\nWindows\r\n\r\n* Install [Erlang](http://www.erlang.org/download.html) and [RabbitMQ server](http://www.rabbitmq.com/download.html)\r\n\r\nLinux\r\n\r\n* As Windows, or use your distro's package manager to get RabbitMQ (you should get Erlang automatically)\r\n  * (example, for Ubuntu: `sudo apt-get install rabbitmq-server`)\r\n\r\nTo check your installation is working, try the `SimpleSample` console app included\r\n\r\nGetting Started: Path of least resistance\r\n-----------------------------------------\r\n* Add NuGet reference from [SevenDigital.Messaging](https://nuget.org/packages/SevenDigital.Messaging)\r\n\r\nConfigure messaging:\r\n```csharp\r\nMessagingSystem.Configure.WithDefaults();\r\n```\r\n\r\nDefine a message:\r\n```csharp\r\n// Message contract (defined in both sender and receiver)\r\npublic interface IExampleMessage : IMessage {\r\n\tstring Hello {get;set;}\r\n}\r\n\r\n// A specific instance (only needs to be defined in sender)\r\nclass MyExample : IExampleMessage {\r\n\tpublic string Hello {get;set;}\r\n}\r\n```\r\n\r\nSetup a message handler:\r\n```csharp\r\npublic class MyHandler : IHandle\u003cIExampleMessage\u003e {\r\n\tpublic void Handle(IExampleMessage msg) {\r\n\t\tConsole.WriteLine(\"Hello, \"+msg.Hello);\r\n\t}\r\n}\r\n```\r\n\r\nRegister handler with listener:\r\n```csharp\r\n// Spawns sets of background threads to handle incoming messages\r\nusing (MessagingSystem.Receiver().Listen(_=\u003e_.Handle\u003cIExampleMessage\u003e().With\u003cMyHandler\u003e())) {\r\n\twhile (true) {Thread.Sleep(1000);}\r\n}\r\nMessagingSystem.Control.Shutdown();\r\n```\r\n\r\nRegister for load balanced: (if the named queue doesn't exist, it will be created automatically)\r\n```csharp\r\nusing (MessagingSystem.Receiver()\r\n\t\t.TakeFrom(\"MessageQueueName\", _=\u003e_\r\n\t\t.Handle\u003cIExampleMessage\u003e().With\u003cMyHandler\u003e())) {\r\n.\r\n.\r\n.\r\n```\r\n\r\nSend some messages:\r\n```csharp\r\nMessagingSystem.Sender().SendMessage(new MyExample{Hello = \"World\"});\r\n```\r\n\r\nNotes\r\n-----\r\n* Messaging.Receiver() to get a new `IReceiver` instance (this uses StructureMap under the hood)\r\n* Creating listener nodes takes time and resources. Do it infrequently -- usually once at the start of your app.\r\n* Your handler will get `new()`'d for every message. Don't do anything complex in the handler constructor!\r\n* To listen to messages, `factory.Listener(binder=\u003ebinder.Handle\u003cIMyMessageInterface\u003e().With\u003cMyHandlerType\u003e()`\r\n* Each listener can handle any number of message =\u003e handler pairs, and a message can have more than one handler (they all fire in parallel)\r\n\r\nSee further simple examples in the Integration Tests.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fsevendigital.messaging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi-e-b%2Fsevendigital.messaging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fsevendigital.messaging/lists"}