Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrieljoelc/dotnet-bus
https://github.com/gabrieljoelc/dotnet-bus
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gabrieljoelc/dotnet-bus
- Owner: gabrieljoelc
- Created: 2021-03-26T23:03:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-27T00:56:24.000Z (almost 4 years ago)
- Last Synced: 2023-11-04T20:19:22.958Z (about 1 year ago)
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dotnet bus
Use conventions to publish webhook requests to the bus.
Components:
1. Create topics, subscriptions on app startup - Charles
Prototype creating topics and subscriptions (hardcoded) in Console App using [ManagementClient](https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.management.managementclient?view=azure-dotnet) class.
- inputs: service bus namespace connection string (config / app settings), topic name string, subscription name string
- outputs: service bus resources are created if not existing in Azure```
public interface ITopicAndSubscriptionBuilder
{
Task Build(string topic, string subscription name);
}internal class AzureServiceBusTopicAndSubscriptionBuilder
{
public async Task Build(string topic, string subscription)
{
if (!ManagmentClient.TopicExists(topic)) ///...
if (!ManagmentClient.SubscriptionExists(subscription)) ///...
}
}
```2. Infer topic, subscription names from strong-types - Gabe
Prototype an interface that can provide topic and subscription discovery at app startup.
- inputs: interface implementations in assembly
- outputs: topic and subscription name strings```
public interface IHandler
{
Task Handle(TMessage message);
}var topicsAndSubscription = Assembly.GetTypes().Where(x => x.IsInterface(typeof(IHandler<>))).Select(x => new { x.Topic, x.Subscription);
foreach (var topicAndSub in topicsAndSubscription)
{
TopicAndSubscriptionBuilder.Build(topicAndSub.Topic, topicAndSub.Subscription);
}
```3. Process web request and publish to the bus in one class - todo