{"id":21940145,"url":"https://github.com/softeq/eventdrivencommunication","last_synced_at":"2025-10-09T21:32:09.834Z","repository":{"id":34130816,"uuid":"155704348","full_name":"Softeq/EventDrivenCommunication","owner":"Softeq","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-24T13:20:29.000Z","size":136,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-14T14:31:44.460Z","etag":null,"topics":["dotnet","eventbus","microservice","netkit"],"latest_commit_sha":null,"homepage":null,"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/Softeq.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,"zenodo":null}},"created_at":"2018-11-01T11:22:30.000Z","updated_at":"2025-03-17T11:47:53.000Z","dependencies_parsed_at":"2025-07-24T09:28:51.195Z","dependency_job_id":"9112f313-1ba9-4b61-901d-f3294a7b4b4e","html_url":"https://github.com/Softeq/EventDrivenCommunication","commit_stats":{"total_commits":11,"total_committers":5,"mean_commits":2.2,"dds":0.5454545454545454,"last_synced_commit":"b31d87d8952bb09ac7ea2b85c223f6c8c1c41d36"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Softeq/EventDrivenCommunication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FEventDrivenCommunication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FEventDrivenCommunication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FEventDrivenCommunication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FEventDrivenCommunication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Softeq","download_url":"https://codeload.github.com/Softeq/EventDrivenCommunication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FEventDrivenCommunication/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002051,"owners_count":26083286,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dotnet","eventbus","microservice","netkit"],"created_at":"2024-11-29T02:29:12.654Z","updated_at":"2025-10-09T21:32:09.553Z","avatar_url":"https://github.com/Softeq.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![NuGet](https://img.shields.io/nuget/v/Softeq.NetKit.EventDrivenCommunication.svg)\n![Azure DevOps builds](https://img.shields.io/azure-devops/build/SofteqDevelopment/NetKit/16.svg)\n\n# NetKit.EventDrivenCommunication\n\nNetKit.EventDrivenCommunication is a messaging component that enables Pub\\Sub communication between system components or services.\n\n# Structure\n\n1. ```Softeq.NetKit.Components.EventBus``` - exposes core Pub\\Sub abstractions and models of the component. \n2. ```Softeq.NetKit.Components.EventBus.Service``` - Pub\\Sub implementation that uses Azure Service Bus as a communication mechanins.\n3. ```Softeq.NetKit.Integrations.EventLog``` - SQL DB Store for event state. \n\n# Getting Started\n\n## Install \n1. Check-out master branch from repository\n2. Add a reference to Softeq.NetKit.Components.EventBus into target project.\n3. Add a reference to Softeq.NetKit.Components.EventBus.Service into target project.\n4. (Optional) Add a reference to Softeq.NetKit.Integrations.EventLog into target project.\n\n## Develop\n\n1. Create custom event class inherited from ```IntegrationEvent``` base class\n```csharp\n    public class UserCreatedEvent : IntegrationEvent\n\t{\n\t\tpublic UserCreatedEvent(Guid userId)\n\t\t{\n\t\t    UserId = userId;\n\t\t}\n\n\t\tpublic Guid UserId { get; set; }\n\t}\n```\n\n2. Implement ```IEventHandler\u003c\u003e``` interface to handle received custom events\n```csharp\n    public class UserCreatedEventHandler : IEventHandler\u003cUserCreatedEvent\u003e\n    {\n\t    public async Task Handle(UserCreatedEvent @event)\n\t    {\n\t\t    //Code goes here\n\t    }\n    }\n\n```\n\n## Configure DI Container\n\n1. Set up and register ServiceBus configuration ```ServiceBusPersisterConnectionConfiguration``` in your DI container\n```csharp\n    builder.Register(x =\u003e\n    {\n        var context = x.Resolve\u003cIComponentContext\u003e();\n        var config = context.Resolve\u003cIConfiguration\u003e();\n        return new ServiceBusPersisterConnectionConfiguration\n        {\n            ConnectionString = config[\"CONN_STR\"],\n            TopicConfiguration = new ServiceBusPersisterTopicConnectionConfiguration\n            {\n                TopicName = config[\"TOPIC\"],\n                SubscriptionName = config[\"SUBSCRIPTION\"] \n            },\n            QueueConfiguration = new ServiceBusPersisterQueueConnectionConfiguration\n            {\n                QueueName = config[\"QUEUE\"]\n            }\n        };\n    }).As\u003cServiceBusPersisterConnectionConfiguration\u003e();\n\n```\n\n2. Register ```IServiceBusPersisterConnection``` implementation\n```csharp\n    builder.RegisterType\u003cServiceBusPersisterConnection\u003e()\n        .As\u003cIServiceBusPersisterConnection\u003e();\n\n```\n\n3. Set up and register Service Bus message configuration ```MessageQueueConfiguration```\n```csharp\n    builder.Register(context =\u003e\n    {\n        var config = context.Resolve\u003cIConfiguration\u003e();\n\n        return new MessageQueueConfiguration\n        {\n            TimeToLive = Convert.ToInt32(config[\"MSG_TTL\"])\n        };\n    });\n```\n\n4. Register ```IEventBusSubscriptionsManager``` implementation\n```csharp\n    builder.RegisterType\u003cEventBusSubscriptionsManager\u003e()\n                .As\u003cIEventBusSubscriptionsManager\u003e();\n\n```\n\n5. Register ```IEventBusService``` implementation\n```csharp\n    builder.RegisterType\u003cEventBusService\u003e()\n                .As\u003cIEventBusPublisher\u003e();\n    builder.RegisterType\u003cEventBusService\u003e()\n                .As\u003cIEventBusSubscriber\u003e();\n\n``` \n\n6. Register ```IEventHandler``` implementations\n```csharp\n    builder.RegisterType\u003cUserCreatedEventHandler\u003e();\n``` \n\n7. (Optional) Register ```IIntegrationEventLogService``` implementation\n```csharp\n    builder.RegisterType\u003cIntegrationEventLogService\u003e()\n                .As\u003cIIntegrationEventLogService\u003e();\n\n```\n\n## Configure service\n\n1. Enable the listeners on desired event sources\n```csharp\n    IEventBusSubscriber eventBus;\n    eventBus.RegisterQueueListener();\n    eventBus.RegisterSubscriptionListenerAsync().GetAwaiter().GetResult();\n```\n\n2. Register your custom event handlers\n```csharp\n    eventBus.SubscribeAsync\u003cUserCreatedEvent, UserCreatedEventHandler\u003e().GetAwaiter().GetResult();\n```\n\n## Use\n\nInject ```IEventBusPublisher``` and ```IIntegrationEventLogService``` into your service\n\n```csharp\n    public class SomeService\n    {\n        private readonly IEventBusPublisher _eventPublisher;\n        private readonly IIntegrationEventLogService _eventLogService;\n\n        public SomeService(IEventBusPublisher eventPublisher, IIntegrationEventLogService eventLogService)\n        {\n            _eventPublisher = eventPublisher;\n            _eventLogService = eventLogService;\n        }\n\n        public async Task Do(UserCreatedEvent @event)\n        {\n            await _eventLogService.SaveAsync(@event);\n            await _eventPublisher.PublishToTopicAsync(@event, delayInSeconds);\n            await _eventLogService.MarkAsPublishedAsync(@event);\n        }\n    }\n```\n\n## About\n\nThis project is maintained by Softeq Development Corp.\n\nWe specialize in .NET core applications.\n\n## Contributing\n\nWe welcome any contributions.\n\n## License\n\nThe Query Utils project is available for free use, as described by the [LICENSE](/LICENSE) (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofteq%2Feventdrivencommunication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofteq%2Feventdrivencommunication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofteq%2Feventdrivencommunication/lists"}