├── src
├── simplemessagebus.snk
├── simplemessagebus-logo.png
├── SimpleMessageBus.Samples.OnPrem
│ ├── appsettings.json
│ ├── Functions.cs
│ ├── SimpleMessageBus.Samples.OnPrem.csproj
│ ├── Program.cs
│ └── EmailMessageHandler.cs
├── SimpleMessageBus.Samples.Blazor.WebAssembly
│ ├── Pages
│ │ ├── Home.razor
│ │ ├── Counter.razor
│ │ └── Weather.razor
│ ├── wwwroot
│ │ ├── favicon.png
│ │ ├── icon-192.png
│ │ ├── icon-512.png
│ │ ├── service-worker.js
│ │ ├── sample-data
│ │ │ └── weather.json
│ │ ├── manifest.webmanifest
│ │ └── index.html
│ ├── Layout
│ │ ├── MainLayout.razor
│ │ ├── NavMenu.razor
│ │ └── MainLayout.razor.css
│ ├── _Imports.razor
│ ├── App.razor
│ ├── Program.cs
│ └── SimpleMessageBus.Samples.Blazor.WebAssembly.csproj
├── global.json
├── SimpleMessageBus.Templates.AzureWebJob
│ ├── SimpleMessageBus.Templates.AzureWebJob.csproj
│ └── .template.config
│ │ └── template.json
├── SimpleMessageBus.Templates.WindowsService
│ ├── SimpleMessageBus.Templates.WindowsService.csproj
│ └── .template.config
│ │ └── template.json
├── SimpleMessageBus.Samples.AzureWebJobs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Program.cs
│ └── SimpleMessageBus.Samples.AzureWebJobs.csproj
├── SimpleMessageBus.Docs
│ ├── api-reference
│ │ ├── System
│ │ │ ├── index.mdx
│ │ │ ├── Collections
│ │ │ │ └── Concurrent
│ │ │ │ │ └── index.mdx
│ │ │ └── Type.mdx
│ │ ├── Microsoft
│ │ │ ├── Azure
│ │ │ │ └── WebJobs
│ │ │ │ │ └── index.mdx
│ │ │ ├── Extensions
│ │ │ │ ├── Hosting
│ │ │ │ │ └── index.mdx
│ │ │ │ └── DependencyInjection
│ │ │ │ │ ├── index.mdx
│ │ │ │ │ └── IServiceCollection.mdx
│ │ │ └── AspNetCore
│ │ │ │ └── Components
│ │ │ │ └── WebAssembly
│ │ │ │ └── Hosting
│ │ │ │ ├── index.mdx
│ │ │ │ └── WebAssemblyHostBuilder.mdx
│ │ ├── CloudNimble
│ │ │ └── SimpleMessageBus
│ │ │ │ ├── Amazon
│ │ │ │ └── Core
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── Dispatch
│ │ │ │ ├── Kafka
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── Amazon
│ │ │ │ │ ├── AmazonSQSConstants.mdx
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── IndexedDb
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── IQueueProcessor.mdx
│ │ │ │ └── Triggers
│ │ │ │ │ ├── index.mdx
│ │ │ │ │ └── ISimpleMessageBusFileProcessorFactory.mdx
│ │ │ │ ├── Publish
│ │ │ │ ├── IndexedDb
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── Amazon
│ │ │ │ │ ├── AmazonSQSConstants.mdx
│ │ │ │ │ └── index.mdx
│ │ │ │ ├── Kafka
│ │ │ │ │ ├── index.mdx
│ │ │ │ │ └── IKafkaKeyProvider.mdx
│ │ │ │ ├── index.mdx
│ │ │ │ ├── IKafkaKeyProvider.mdx
│ │ │ │ └── IMessagePublisher.mdx
│ │ │ │ ├── Core
│ │ │ │ ├── KafkaConstants.mdx
│ │ │ │ ├── FileSystemConstants.mdx
│ │ │ │ ├── AzureStorageQueueConstants.mdx
│ │ │ │ ├── KafkaBrokerProtocol.mdx
│ │ │ │ ├── KafkaAuthenticationMode.mdx
│ │ │ │ └── AzureStorageQueueEncoding.mdx
│ │ │ │ ├── Breakdance
│ │ │ │ └── index.mdx
│ │ │ │ └── IndexedDb
│ │ │ │ └── Core
│ │ │ │ ├── IndexedDbConstants.mdx
│ │ │ │ └── index.mdx
│ │ └── index.mdx
│ ├── SimpleMessageBus.Docs.docsproj
│ ├── snippets
│ │ └── DocsBadge.jsx
│ └── assembly-list.txt
├── SimpleMessageBus.Tests.Dispatch
│ ├── appsettings.json
│ └── SimpleMessageBus.Tests.Dispatch.csproj
├── SimpleMessageBus.Tests.Publish
│ ├── UnitTest1.cs
│ └── SimpleMessageBus.Tests.Publish.csproj
├── SimpleMessageBus.Templates.Core
│ ├── SimpleMessageBus.Templates.Core.csproj
│ └── .template.config
│ │ └── template.json
├── SimpleMessageBus.Tests.Shared
│ ├── SimpleMessageBus.Tests.Shared.csproj
│ └── TestMessage.cs
├── SimpleMessageBus.Samples.Core
│ ├── SimpleMessageBus.Samples.Core.csproj
│ └── NewUserMessage.cs
├── SimpleMessageBus.Tests.Dispatch.FileSystem
│ ├── appsettings.json
│ ├── Extensions
│ │ └── FileSystem_IHostBuilderExtensions.cs
│ ├── SimpleMessageBus.Tests.Dispatch.FileSystem.csproj
│ └── FileSystemNameResolverTests.cs
├── SimpleMessageBus.Templates.Dispatch
│ ├── SimpleMessageBus.Templates.Dispatch.csproj
│ └── .template.config
│ │ └── template.json
├── .editorconfig
├── SimpleMessageBus.Samples.Blazor.WorkerService
│ ├── Program.cs
│ └── SimpleMessageBus.Samples.Blazor.WorkerService.csproj
├── SimpleMessageBus.Tools
│ ├── SimpleMessageBus.Tools.csproj
│ └── Program.cs
├── SimpleMessageBus.Dispatch.FileSystem
│ ├── Triggers
│ │ ├── Listener
│ │ │ ├── SimpleMessageBusFileProcessorFactory.cs
│ │ │ ├── ProcessingStates.cs
│ │ │ ├── ISimpleMessageBusFileProcessorFactory.cs
│ │ │ ├── StatusFileEntry.cs
│ │ │ └── SimpleMessageBusFileProcessorFactoryContext.cs
│ │ └── Config
│ │ │ └── Files_IWebJobsBuilderExtensions.cs
│ ├── SimpleMessageBus.Dispatch.FileSystem.csproj
│ ├── FilesOptionsConfiguration.cs
│ └── QueueProcessors
│ │ └── FileSystemNameResolver.cs
├── SimpleMessageBus.Core
│ ├── Kafka
│ │ ├── KafkaBrokerProtocol.cs
│ │ ├── KafkaAuthenticationMode.cs
│ │ ├── KafkaConstants.cs
│ │ └── KafkaOptions.cs
│ ├── FileSystem
│ │ └── FileSystemConstants.cs
│ ├── Azure
│ │ ├── AzureStorageQueueConstants.cs
│ │ └── AzureStorageQueueEncoding.cs
│ ├── Extensions
│ │ └── TypeExtensions.cs
│ ├── IMessage.cs
│ └── SimpleMessageBus.Core.csproj
├── SimpleMessageBus.Tests.Core
│ ├── SimpleMessageBus.Tests.Core.csproj
│ └── MessageEnvelopeTests.cs
├── SimpleMessageBus.IndexedDb.Core
│ ├── IndexedDbConstants.cs
│ ├── SimpleMessageBus.IndexedDb.Core.csproj
│ ├── SimpleMessageBusDb.cs
│ └── IndexedDbOptions.cs
├── SimpleMessageBus.Samples.ExternalTriggers
│ ├── Extensions
│ │ └── IServiceCollectionExtensions.cs
│ ├── SimpleMessageBus.Samples.ExternalTriggers.csproj
│ └── SampleTimers.cs
├── SimpleMessageBus.Samples.SimpleClientApp
│ ├── SimpleMessageBus.Samples.SimpleClientApp.csproj
│ └── Program.cs
├── SimpleMessageBus.Breakdance
│ └── SimpleMessageBus.Breakdance.csproj
├── SimpleMessageBus.Templates.Package
│ ├── SimpleMessageBus.Templates.Projects.csproj
│ ├── .template.config
│ │ └── template.json
│ └── CloudNimble.SimpleMessageBus.Templates.sln
├── SimpleMessageBus.Dispatch
│ ├── IQueueProcessor.cs
│ ├── IMessageDispatcher.cs
│ ├── SimpleMessageBus.Dispatch.csproj
│ └── Extensions
│ │ └── IHostBuilderExtensions.cs
├── SimpleMessageBus.Dispatch.Amazon
│ ├── AmazonSQSConstants.cs
│ ├── SimpleMessageBus.Dispatch.Amazon.csproj
│ └── QueueProcessors
│ │ └── AmazonSQSNameResolver.cs
├── SimpleMessageBus.Publish.Amazon
│ ├── AmazonSQSConstants.cs
│ └── SimpleMessageBus.Publish.Amazon.csproj
├── SimpleMessageBus.Amazon.Core
│ └── SimpleMessageBus.Amazon.Core.csproj
├── SimpleMessageBus.Publish.Kafka
│ ├── SimpleMessageBus.Publish.Kafka.csproj
│ └── IKafkaKeyProvider.cs
├── SimpleMessageBus.Dispatch.Kafka
│ ├── SimpleMessageBus.Dispatch.Kafka.csproj
│ └── QueueProcessors
│ │ └── KafkaNameResolver.cs
├── SimpleMessageBus.Hosting
│ ├── SimpleMessageBus.Hosting.csproj
│ └── Extensions
│ │ └── IHostBuilderExtensions.cs
├── SimpleMessageBus.Publish
│ ├── IMessagePublisher.cs
│ ├── SimpleMessageBus.Publish.csproj
│ └── Extensions
│ │ └── IHostBuilderExtensions.cs
├── SimpleMessageBus.Tests.Dispatch.Kafka
│ ├── KafkaProcessorTests.cs
│ └── SimpleMessageBus.Tests.Dispatch.Kafka.csproj
├── SimpleMessageBus.Publish.Azure
│ ├── SimpleMessageBus.Publish.Azure.csproj
│ └── Extensions
│ │ └── IHostBuilderExtensions.cs
├── SimpleMessageBus.Publish.IndexedDb
│ ├── SimpleMessageBus.Publish.IndexedDb.csproj
│ ├── Extensions
│ │ ├── WebAssemblyHostBuilderExtensions.cs
│ │ └── IHostBuilderExtensions.cs
│ └── IndexedDbMessagePublisher.cs
├── SimpleMessageBus.Dispatch.Azure
│ ├── SimpleMessageBus.Dispatch.Azure.csproj
│ ├── QueuesOptionsConfiguration.cs
│ └── QueueProcessors
│ │ └── AzureStorageQueueNameResolver.cs
├── SimpleMessageBus.Dispatch.IndexedDb
│ └── SimpleMessageBus.Dispatch.IndexedDb.csproj
└── SimpleMessageBus.Tests.Dispatch.Azure
│ └── SimpleMessageBus.Tests.Dispatch.Azure.csproj
├── .claude
└── settings.local.json
├── LICENSE
└── .github
├── PULL_REQUEST_TEMPLATE.md
├── ISSUE_TEMPLATE
└── bug_report_request.yml
└── copilot-instructions.md
/src/simplemessagebus.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudNimble/SimpleMessageBus/HEAD/src/simplemessagebus.snk
--------------------------------------------------------------------------------
/src/simplemessagebus-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudNimble/SimpleMessageBus/HEAD/src/simplemessagebus-logo.png
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.OnPrem/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "FileSystemOptions": {
3 | "RootFolder": "D:\\Scratch\\SimpleMessageBus"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Pages/Home.razor:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 | Home
4 |
5 |
Hello, world!
6 |
7 | Welcome to your new app.
8 |
--------------------------------------------------------------------------------
/src/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "10.0.100",
4 | "rollForward": "latestPatch"
5 | },
6 | "test": {
7 | "runner": "Microsoft.Testing.Platform"
8 | }
9 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudNimble/SimpleMessageBus/HEAD/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/favicon.png
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudNimble/SimpleMessageBus/HEAD/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/icon-192.png
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudNimble/SimpleMessageBus/HEAD/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/icon-512.png
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.AzureWebJob/SimpleMessageBus.Templates.AzureWebJob.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.WindowsService/SimpleMessageBus.Templates.WindowsService.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.AzureWebJobs/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "APPINSIGHTS_INSTRUMENTATIONKEY": "",
3 | "AzureQueueOptions": {
4 | "QueueName": "smb-local",
5 | "StorageConnectionString": "UseDevelopmentStorage=true"
6 | }
7 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/System/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the System Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['System', 'namespace', 'Type']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "AzureWebJobsStorage": "UseDevelopmentStorage=true"
4 | },
5 | "AzureStorageQueueOptions": {
6 | "StorageConnectionString": "UseDevelopmentStorage=true"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.AzureWebJobs/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "AzureStorageQueueOptions": {
3 | "StorageConnectionString": "UseDevelopmentStorage=true"
4 | },
5 | "ConnectionStrings": {
6 | "AzureWebJobsStorage": "UseDevelopmentStorage=true"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/Azure/WebJobs/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the Microsoft.Azure.WebJobs Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['Microsoft.Azure.WebJobs', 'namespace', 'IWebJobsBuilder']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/Extensions/Hosting/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the Microsoft.Extensions.Hosting Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['Microsoft.Extensions.Hosting', 'namespace', 'IHostBuilder']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Publish/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 |
3 | namespace SimpleMessageBus.Tests.Publish
4 | {
5 | [TestClass]
6 | public class UnitTest1
7 | {
8 | [TestMethod]
9 | public void TestMethod1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/System/Collections/Concurrent/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the System.Collections.Concurrent Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['System.Collections.Concurrent', 'namespace', 'ConcurrentDictionary']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/service-worker.js:
--------------------------------------------------------------------------------
1 | // In development, always fetch from the network and do not enable offline support.
2 | // This is because caching would make development more difficult (changes would not
3 | // be reflected on the first load after each change).
4 | self.addEventListener('fetch', () => { });
5 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/Extensions/DependencyInjection/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the Microsoft.Extensions.DependencyInjection Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['Microsoft.Extensions.DependencyInjection', 'namespace', 'IServiceCollection']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Core/SimpleMessageBus.Templates.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Shared/SimpleMessageBus.Tests.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Core/SimpleMessageBus.Samples.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Publish/SimpleMessageBus.Tests.Publish.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/AspNetCore/Components/WebAssembly/Hosting/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the Microsoft.AspNetCore.Components.WebAssembly.Hosting Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['Microsoft.AspNetCore.Components.WebAssembly.Hosting', 'namespace', 'WebAssemblyHostBuilder']
7 | ---
8 |
9 | ## Types
10 |
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.FileSystem/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "AzureWebJobsStorage": "UseDevelopmentStorage=true"
4 | },
5 | "AzureStorageQueueOptions": {
6 | "StorageConnectionString": "UseDevelopmentStorage=true"
7 | },
8 | "SimpleMessageBus": {
9 | "FileSystemOptions": {
10 | "RootFolder": "C:\\Temp\\SimpleMessageBus"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Dispatch/SimpleMessageBus.Templates.Dispatch.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Pages/Counter.razor:
--------------------------------------------------------------------------------
1 | @page "/counter"
2 |
3 | Counter
4 |
5 | Counter
6 |
7 | Current count: @currentCount
8 |
9 |
10 |
11 | @code {
12 | private int currentCount = 0;
13 |
14 | private void IncrementCount()
15 | {
16 | currentCount++;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # CA1062: Validate arguments of public methods
4 | dotnet_diagnostic.CA1062.severity = suggestion
5 |
6 | # CA2007: Consider calling ConfigureAwait on the awaited task
7 | dotnet_diagnostic.CA2007.severity = suggestion
8 |
9 | # CA1031: Do not catch general exception types
10 | dotnet_diagnostic.CA1031.severity = suggestion
11 |
12 | # IDE0060: Remove unused parameter
13 | dotnet_code_quality_unused_parameters = all:suggestion
14 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WorkerService/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SimpleMessageBus.Samples.Blazor.WorkerService
4 | {
5 |
6 |
7 | public class Program
8 | {
9 |
10 | static void Main()
11 | {
12 | if (!OperatingSystem.IsBrowser())
13 | {
14 | throw new PlatformNotSupportedException("Can only be run in the browser!");
15 | }
16 | }
17 |
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tools/SimpleMessageBus.Tools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | simplemessagebus
5 | True
6 | Exe
7 | net10.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Layout/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
6 |
7 |
8 |
11 |
12 |
13 | @Body
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using System.Net.Http.Json
3 | @using Microsoft.AspNetCore.Components.Forms
4 | @using Microsoft.AspNetCore.Components.Routing
5 | @using Microsoft.AspNetCore.Components.Web
6 | @using Microsoft.AspNetCore.Components.Web.Virtualization
7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http
8 | @using Microsoft.JSInterop
9 | @using SimpleMessageBus.Samples.Blazor.WebAssembly
10 | @using SimpleMessageBus.Samples.Blazor.WebAssembly.Layout
11 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/App.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Not found
8 |
9 | Sorry, there's nothing at this address.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/sample-data/weather.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "date": "2022-01-06",
4 | "temperatureC": 1,
5 | "summary": "Freezing"
6 | },
7 | {
8 | "date": "2022-01-07",
9 | "temperatureC": 14,
10 | "summary": "Bracing"
11 | },
12 | {
13 | "date": "2022-01-08",
14 | "temperatureC": -13,
15 | "summary": "Freezing"
16 | },
17 | {
18 | "date": "2022-01-09",
19 | "temperatureC": -16,
20 | "summary": "Balmy"
21 | },
22 | {
23 | "date": "2022-01-10",
24 | "temperatureC": -2,
25 | "summary": "Chilly"
26 | }
27 | ]
28 |
--------------------------------------------------------------------------------
/.claude/settings.local.json:
--------------------------------------------------------------------------------
1 | {
2 | "permissions": {
3 | "allow": [
4 | "Bash(dotnet:*)",
5 | "Bash(find:*)",
6 | "WebFetch(domain:github.com)",
7 | "WebFetch(domain:raw.githubusercontent.com)",
8 | "WebFetch(domain:docs.aws.amazon.com)",
9 | "Bash(rg:*)",
10 | "Bash(timeout:*)",
11 | "Bash(ls:*)",
12 | "Bash(dotnet test:*)",
13 | "Bash(dotnet build:*)",
14 | "Bash(where:*)",
15 | "Bash(dir:*)",
16 | "Bash(Get-Process:*)",
17 | "Bash(Select-Object -Property ProcessName,Id)",
18 | "Bash(cat:*)"
19 | ],
20 | "deny": []
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/manifest.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SimpleMessageBus.Samples.Blazor",
3 | "short_name": "SimpleMessageBus.Samples.Blazor",
4 | "id": "./",
5 | "start_url": "./",
6 | "display": "standalone",
7 | "background_color": "#ffffff",
8 | "theme_color": "#03173d",
9 | "prefer_related_applications": false,
10 | "icons": [
11 | {
12 | "src": "icon-512.png",
13 | "type": "image/png",
14 | "sizes": "512x512"
15 | },
16 | {
17 | "src": "icon-192.png",
18 | "type": "image/png",
19 | "sizes": "192x192"
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Listener/SimpleMessageBusFileProcessorFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
5 | {
6 | internal class SimpleMessageBusFileProcessorFactory : ISimpleMessageBusFileProcessorFactory
7 | {
8 | public SimpleMessageBusFileProcessor CreateFileProcessor(SimpleMessageBusFileProcessorFactoryContext context)
9 | {
10 | return new SimpleMessageBusFileProcessor(context);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Kafka/KafkaBrokerProtocol.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// Kafka security protocol options.
6 | ///
7 | public enum KafkaBrokerProtocol
8 | {
9 |
10 | /// Plain text communication (no encryption).
11 | Plaintext = 0,
12 |
13 | /// SSL/TLS encrypted communication.
14 | Ssl = 1,
15 |
16 | /// SASL authentication over plain text.
17 | SaslPlaintext = 2,
18 |
19 | /// SASL authentication over SSL/TLS.
20 | SaslSsl = 3
21 |
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/FileSystem/FileSystemConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// A set of helpers to convert file system-related magic strings to compiled references.
6 | ///
7 | public static class FileSystemConstants
8 | {
9 |
10 | ///
11 | ///
12 | ///
13 | public const string Queue = "Queue";
14 |
15 | ///
16 | ///
17 | ///
18 | public const string Completed = "Completed";
19 |
20 | ///
21 | ///
22 | ///
23 | public const string Error = "Error";
24 |
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Core/SimpleMessageBus.Tests.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.IndexedDb.Core/IndexedDbConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.IndexedDb.Core
2 | {
3 |
4 | ///
5 | /// A set of helpers to convert file system-related magic strings to compiled references.
6 | ///
7 | public static class IndexedDbConstants
8 | {
9 |
10 | ///
11 | ///
12 | ///
13 | public const string Queue = "Queue";
14 |
15 | ///
16 | ///
17 | ///
18 | public const string Completed = "Completed";
19 |
20 | ///
21 | ///
22 | ///
23 | public const string Error = "Error";
24 |
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Amazon/Core/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Amazon.Core Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Amazon.Core', 'namespace', 'AmazonSQSOptions']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [AmazonSQSOptions](/api-reference/CloudNimble/SimpleMessageBus/Amazon/Core/AmazonSQSOptions) | Defines the configuration options available for SimpleMessageBus queues backed by Amazon SQS. |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Dispatch.Kafka Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Dispatch.Kafka', 'namespace', 'KafkaProcessor']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [KafkaProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Kafka/KafkaProcessor) | Processes messages from Apache Kafka and dispatches them to registered message handlers. |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.ExternalTriggers/Extensions/IServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using SimpleMessageBus.Samples.ExternalTriggers;
2 |
3 | namespace Microsoft.Extensions.DependencyInjection
4 | {
5 |
6 | ///
7 | ///
8 | ///
9 | public static class IServiceCollectionExtensions
10 | {
11 |
12 | ///
13 | ///
14 | ///
15 | ///
16 | ///
17 | public static IServiceCollection AddTimerDependencies(this IServiceCollection services)
18 | {
19 | //services.AddSingleton();
20 | return services;
21 | }
22 |
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Kafka/KafkaAuthenticationMode.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// SASL authentication mechanisms for Kafka.
6 | ///
7 | public enum KafkaAuthenticationMode
8 | {
9 |
10 | /// No authentication configured.
11 | NotSet = 0,
12 |
13 | /// PLAIN mechanism (username/password).
14 | Plain = 1,
15 |
16 | /// SCRAM-SHA-256 mechanism.
17 | ScramSha256 = 2,
18 |
19 | /// SCRAM-SHA-512 mechanism.
20 | ScramSha512 = 3,
21 |
22 | /// Kerberos (GSSAPI) authentication.
23 | Gssapi = 4
24 |
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/IndexedDb/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Publish.IndexedDb Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Publish.IndexedDb', 'namespace', 'IndexedDbMessagePublisher']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [IndexedDbMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/IndexedDb/IndexedDbMessagePublisher) | Manages the process of publishing MessageBus messages to a browser-based IndexedDb database. |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/KafkaConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: KafkaConstants
3 | description: "Constants for Kafka topic and consumer group configuration placeholders."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['KafkaConstants', 'CloudNimble.SimpleMessageBus.Core.KafkaConstants', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.KafkaConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | Constants for Kafka topic and consumer group configuration placeholders.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.SimpleClientApp/SimpleMessageBus.Samples.SimpleClientApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net10.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Breakdance/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Breakdance Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Breakdance', 'namespace', 'TestableMessagePublisher']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [TestableMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Breakdance/TestableMessagePublisher) | A test double for IMessagePublisher that captures published messages for assertions. Used in testing scenarios to verify that expected messages were published correctly. |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/FileSystemConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: FileSystemConstants
3 | description: "A set of helpers to convert file system-related magic strings to compiled references."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['FileSystemConstants', 'CloudNimble.SimpleMessageBus.Core.FileSystemConstants', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.FileSystemConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | A set of helpers to convert file system-related magic strings to compiled references.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WorkerService/SimpleMessageBus.Samples.Blazor.WorkerService.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0
5 | browser-wasm
6 | Exe
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: AmazonSQSConstants
3 | description: "A set of constants for SimpleMessageBus instances backed by Amazon SQS."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['AmazonSQSConstants', 'CloudNimble.SimpleMessageBus.Publish.Amazon.AmazonSQSConstants', 'CloudNimble.SimpleMessageBus.Publish.Amazon', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Publish.Amazon.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Publish.Amazon
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Publish.Amazon.AmazonSQSConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | A set of constants for SimpleMessageBus instances backed by Amazon SQS.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/AzureStorageQueueConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: AzureStorageQueueConstants
3 | description: "A set of helpers to convert file system-related magic strings to compiled references."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['AzureStorageQueueConstants', 'CloudNimble.SimpleMessageBus.Core.AzureStorageQueueConstants', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.AzureStorageQueueConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | A set of helpers to convert file system-related magic strings to compiled references.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: AmazonSQSConstants
3 | description: "A set of constants for SimpleMessageBus instances backed by Amazon SQS."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['AmazonSQSConstants', 'CloudNimble.SimpleMessageBus.Dispatch.Amazon.AmazonSQSConstants', 'CloudNimble.SimpleMessageBus.Dispatch.Amazon', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Dispatch.Amazon.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Dispatch.Amazon
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Dispatch.Amazon.AmazonSQSConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | A set of constants for SimpleMessageBus instances backed by Amazon SQS.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Breakdance/SimpleMessageBus.Breakdance.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Breakdance
5 | CloudNimble.SimpleMessageBus.Breakdance
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Testing via Breakdance
12 |
13 | Tools for integrating SimpleMesageBus tests in your workflow. Can work standalone or with other
14 | Breakdance packages.
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components.Web;
2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using System;
5 | using System.Net.Http;
6 | using System.Threading.Tasks;
7 |
8 | namespace SimpleMessageBus.Samples.Blazor.WebAssembly
9 | {
10 | public class Program
11 | {
12 | public static async Task Main(string[] args)
13 | {
14 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
15 | builder.RootComponents.Add("#app");
16 | builder.RootComponents.Add("head::after");
17 |
18 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
19 |
20 | await builder.Build().RunAsync();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbConstants.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IndexedDbConstants
3 | description: "A set of helpers to convert file system-related magic strings to compiled references."
4 | icon: bolt
5 | tag: "STATIC"
6 | keywords: ['IndexedDbConstants', 'CloudNimble.SimpleMessageBus.IndexedDb.Core.IndexedDbConstants', 'CloudNimble.SimpleMessageBus.IndexedDb.Core', 'class', 'System.Object']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.IndexedDb.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.IndexedDb.Core
14 |
15 | **Inheritance:** System.Object
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.IndexedDb.Core.IndexedDbConstants
21 | ```
22 |
23 | ## Summary
24 |
25 | A set of helpers to convert file system-related magic strings to compiled references.
26 |
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Listener/ProcessingStates.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
5 | {
6 |
7 | ///
8 | /// Enumeration of the possible processing states a
9 | /// file can be in.
10 | ///
11 | internal enum ProcessingState
12 | {
13 | ///
14 | /// The file is being processed.
15 | ///
16 | Processing,
17 |
18 | ///
19 | /// Processing is complete for the file.
20 | ///
21 | Processed,
22 |
23 | ///
24 | /// Processing has failed for the file.
25 | ///
26 | Failed
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/IndexedDb/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Dispatch.IndexedDb Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Dispatch.IndexedDb', 'namespace', 'IndexedDbQueueProcessor']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [IndexedDbQueueProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/IndexedDb/IndexedDbQueueProcessor) | Processes queue items stored in an IndexedDB database and dispatches them to all [IMessageHandler](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler)IMessageHandlers</see> registered with the DI container. |
16 |
17 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Dispatch.Amazon Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Dispatch.Amazon', 'namespace', 'AmazonSQSConstants', 'AmazonSQSProcessor']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [AmazonSQSConstants](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSConstants) | A set of constants for SimpleMessageBus instances backed by Amazon SQS. |
16 | | [AmazonSQSProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Amazon/AmazonSQSProcessor) | Processes messages from Amazon SQS queues for SimpleMessageBus. |
17 |
18 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Publish.Amazon Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Publish.Amazon', 'namespace', 'AmazonSQSConstants', 'AmazonSQSMessagePublisher']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [AmazonSQSConstants](/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSConstants) | A set of constants for SimpleMessageBus instances backed by Amazon SQS. |
16 | | [AmazonSQSMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/Amazon/AmazonSQSMessagePublisher) | Manages the process of publishing MessageBus messages to Amazon SQS. |
17 |
18 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Core/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "CloudNimble, Inc.",
3 | "classifications": [
4 | "EasyAF",
5 | "Core",
6 | "Library"
7 | ],
8 | "name": "EasyAF Core Objects Library",
9 | "identity": "CloudNimble.EasyAF.Core",
10 | "shortName": "easyaf-core",
11 | "tags": {
12 | "language": "C#",
13 | "type": "project"
14 | },
15 | "preferNameDirectory": true,
16 | "sourceName": "CloudNimble.EasyAF.Templates.Core",
17 | //"groupIdentity": "CloudNimble.EasyAF", // This is to differentiate between language templates
18 | "postActions": [
19 | {
20 | "condition": "(!skipRestore)",
21 | "description": "Restore NuGet packages required by this project.",
22 | "manualInstructions": [
23 | { "text": "Run 'dotnet restore'" }
24 | ],
25 | "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
26 | "continueOnError": true
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.WindowsService/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "CloudNimble, Inc.",
3 | "classifications": [
4 | "EasyAF",
5 | "Core",
6 | "Library"
7 | ],
8 | "name": "EasyAF Core Objects Library",
9 | "identity": "CloudNimble.EasyAF.Core",
10 | "shortName": "easyaf-core",
11 | "tags": {
12 | "language": "C#",
13 | "type": "project"
14 | },
15 | "preferNameDirectory": true,
16 | "sourceName": "CloudNimble.EasyAF.Templates.Core",
17 | //"groupIdentity": "CloudNimble.EasyAF", // This is to differentiate between language templates
18 | "postActions": [
19 | {
20 | "condition": "(!skipRestore)",
21 | "description": "Restore NuGet packages required by this project.",
22 | "manualInstructions": [
23 | { "text": "Run 'dotnet restore'" }
24 | ],
25 | "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
26 | "continueOnError": true
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Package/SimpleMessageBus.Templates.Projects.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SimpleMessageBus.ProjectTemplates
5 | net10.0
6 | dotnet new templates for the CloudNimble SimpleMessageBus
7 | false
8 | Template
9 | $(NoWarn);NU5017;NU5128
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.AzureWebJob/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "CloudNimble, Inc.",
3 | "classifications": [
4 | "EasyAF",
5 | "SimpleMessageBus",
6 | "Azure"
7 | ],
8 | "name": "SimpleMessageBus Azure WebJob",
9 | "identity": "CloudNimble.SimpleMessageBus.WebJob",
10 | "shortName": "simplemessagebus-webjob",
11 | "tags": {
12 | "language": "C#",
13 | "type": "project"
14 | },
15 | "preferNameDirectory": true,
16 | "sourceName": "CloudNimble.SimpleMessageBus.Templates.AzureWebJob",
17 | //"groupIdentity": "CloudNimble.EasyAF", // This is to differentiate between language templates
18 | "postActions": [
19 | {
20 | "condition": "(!skipRestore)",
21 | "description": "Restore NuGet packages required by this project.",
22 | "manualInstructions": [
23 | { "text": "Run 'dotnet restore'" }
24 | ],
25 | "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
26 | "continueOnError": true
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Dispatch/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "CloudNimble, Inc.",
3 | "classifications": [
4 | "EasyAF",
5 | "SimpleMessageBus",
6 | "Library"
7 | ],
8 | "name": "SimpleMessageBus Dispatch Library",
9 | "identity": "CloudNimble.SimpleMessageBus.Dispatch",
10 | "shortName": "simplemessagebus-dispatch",
11 | "tags": {
12 | "language": "C#",
13 | "type": "project"
14 | },
15 | "preferNameDirectory": true,
16 | "sourceName": "CloudNimble.SimpleMessageBus.Templates.Dispatch",
17 | //"groupIdentity": "CloudNimble.EasyAF", // This is to differentiate between language templates
18 | "postActions": [
19 | {
20 | "condition": "(!skipRestore)",
21 | "description": "Restore NuGet packages required by this project.",
22 | "manualInstructions": [
23 | { "text": "Run 'dotnet restore'" }
24 | ],
25 | "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
26 | "continueOnError": true
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Azure/AzureStorageQueueConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// A set of helpers to convert file system-related magic strings to compiled references.
6 | ///
7 | public static class AzureStorageQueueConstants
8 | {
9 |
10 | ///
11 | ///
12 | ///
13 | public const string Queue = "queue";
14 |
15 | ///
16 | ///
17 | ///
18 | public const string QueueTriggerAttribute = "%queue%";
19 |
20 | ///
21 | ///
22 | ///
23 | public const string CompletedQueueAttribute = "%completedqueue%";
24 |
25 | ///
26 | ///
27 | ///
28 | public const string CompletedQueue = "queue-completed";
29 |
30 | ///
31 | public const string LocalConnectionString = "UseDevelopmentStorage=true";
32 |
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch/IQueueProcessor.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Dispatch
2 | {
3 |
4 | ///
5 | /// Defines the contract for queue processing components in the SimpleMessageBus system.
6 | ///
7 | ///
8 | /// This interface serves as a marker interface for queue processors, allowing for dependency injection
9 | /// registration and service discovery. Concrete implementations handle the specifics of reading messages
10 | /// from different queue providers (Azure, Amazon, FileSystem, etc.) and dispatching them to message handlers.
11 | ///
12 | /// The interface is intentionally empty to allow maximum flexibility in implementation while providing
13 | /// a common contract for the dependency injection system.
14 | ///
15 | #pragma warning disable CA1040 // Avoid empty interfaces
16 | public interface IQueueProcessor
17 | #pragma warning restore CA1040 // Avoid empty interfaces
18 | {
19 |
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tools/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 | using McMaster.Extensions.CommandLineUtils;
4 |
5 | namespace SimpleMessageBus.Tools
6 | {
7 | [Command(Description = "My global command line tool.")]
8 | class Program
9 | {
10 | public static int Main(string[] args) => CommandLineApplication.Execute(args);
11 |
12 | [Argument(0, Description = "A positional parameter that must be specified.\nThe name of the person to greet.")]
13 | [Required]
14 | public string Name { get; }
15 |
16 | [Option(Description = "An optional parameter, with a default value.\nThe number of times to say hello.")]
17 | [Range(1, 1000)]
18 | public int Count { get; } = 1;
19 |
20 | private int OnExecute()
21 | {
22 | for (var i = 0; i < Count; i++)
23 | {
24 | Console.WriteLine($"Hello {Name}!");
25 | }
26 | return 0;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Amazon/AmazonSQSConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Dispatch.Amazon
2 | {
3 |
4 | ///
5 | /// A set of constants for SimpleMessageBus instances backed by Amazon SQS.
6 | ///
7 | public static class AmazonSQSConstants
8 | {
9 |
10 | #region Properties
11 |
12 | ///
13 | /// The WebJobs attribute name for the name of the completed messages queue.
14 | ///
15 | public const string CompletedQueueAttribute = "%CompletedQueueName%";
16 |
17 | ///
18 | /// The WebJobs attribute name for the name of the poison messages queue.
19 | ///
20 | public const string PoisonQueueAttribute = "%PoisonQueueName%";
21 |
22 | ///
23 | /// The WebJobs attribute name for the name of the queue triggers.
24 | ///
25 | public const string QueueTriggerAttribute = "%QueueName%";
26 |
27 | #endregion
28 |
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Amazon/AmazonSQSConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Publish.Amazon
2 | {
3 |
4 | ///
5 | /// A set of constants for SimpleMessageBus instances backed by Amazon SQS.
6 | ///
7 | public static class AmazonSQSConstants
8 | {
9 |
10 | #region Properties
11 |
12 | ///
13 | /// The WebJobs attribute name for the name of the completed messages queue.
14 | ///
15 | public const string CompletedQueueAttribute = "%CompletedQueueName%";
16 |
17 | ///
18 | /// The WebJobs attribute name for the name of the poison messages queue.
19 | ///
20 | public const string PoisonQueueAttribute = "%PoisonQueueName%";
21 |
22 | ///
23 | /// The WebJobs attribute name for the name of the queue triggers.
24 | ///
25 | public const string QueueTriggerAttribute = "%QueueName%";
26 |
27 | #endregion
28 |
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/KafkaBrokerProtocol.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: KafkaBrokerProtocol
3 | description: "Kafka security protocol options."
4 | icon: list-ol
5 | tag: "ENUM"
6 | keywords: ['KafkaBrokerProtocol', 'CloudNimble.SimpleMessageBus.Core.KafkaBrokerProtocol', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Enum']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Enum
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.KafkaBrokerProtocol
21 | ```
22 |
23 | ## Summary
24 |
25 | Kafka security protocol options.
26 |
27 | ## Values
28 |
29 | | Name | Value | Description |
30 | |------|-------|-------------|
31 | | `Plaintext` | 0 | Plain text communication (no encryption). |
32 | | `Ssl` | 1 | SSL/TLS encrypted communication. |
33 | | `SaslPlaintext` | 2 | SASL authentication over plain text. |
34 | | `SaslSsl` | 3 | SASL authentication over SSL/TLS. |
35 |
36 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Listener/ISimpleMessageBusFileProcessorFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
5 | {
6 |
7 | ///
8 | /// Factory interface for creating instances. This factory pattern allows
9 | /// different FileProcessors to be used for different job functions.
10 | ///
11 | public interface ISimpleMessageBusFileProcessorFactory
12 | {
13 |
14 | ///
15 | /// Create a for the specified inputs.
16 | ///
17 | /// The context to use.
18 | /// The
19 | SimpleMessageBusFileProcessor CreateFileProcessor(SimpleMessageBusFileProcessorFactoryContext context);
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Extensions/TypeExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 |
3 | namespace System
4 | {
5 |
6 | ///
7 | /// Extension methods to augment .
8 | ///
9 | public static class TypeExtensions
10 | {
11 |
12 | ///
13 | /// Guarantees the creation of an AssemblyQualifiedName that does not contain version or key details. That way when AssemblyVersions are incremented,
14 | /// the system will still attempt to process the .
15 | ///
16 | ///
17 | /// A string containing the name in the format "FullTypeName, SimpleAssemblyName".
18 | public static string SimpleAssemblyQualifiedName(this Type type)
19 | {
20 | if (type is null)
21 | {
22 | throw new ArgumentNullException(nameof(type));
23 | }
24 | return $"{type.FullName}, {type.Assembly.GetName().Name}";
25 | }
26 |
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Azure/AzureStorageQueueEncoding.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// Determines how QueueMessage.Body is represented in HTTP requests and responses.
6 | ///
7 | public enum AzureStorageQueueEncoding
8 | {
9 |
10 | ///
11 | /// The QueueMessage.Body is represented verbatim in HTTP requests and responses. I.e. message is not transformed.
12 | ///
13 | None = 0,
14 |
15 | ///
16 | /// The QueueMessage.Body is represented as Base64 encoded string in HTTP requests and responses.
17 | ///
18 | ///
19 | /// This was the default behavior in the prior v11 library. See
20 | /// CloudQueue.EncodeMessage.
21 | /// Using this option can make interop with an existing application easier.
22 | ///
23 | Base64 = 1,
24 |
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2023 CloudNimble
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/KafkaAuthenticationMode.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: KafkaAuthenticationMode
3 | description: "SASL authentication mechanisms for Kafka."
4 | icon: list-ol
5 | tag: "ENUM"
6 | keywords: ['KafkaAuthenticationMode', 'CloudNimble.SimpleMessageBus.Core.KafkaAuthenticationMode', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Enum']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Enum
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.KafkaAuthenticationMode
21 | ```
22 |
23 | ## Summary
24 |
25 | SASL authentication mechanisms for Kafka.
26 |
27 | ## Values
28 |
29 | | Name | Value | Description |
30 | |------|-------|-------------|
31 | | `NotSet` | 0 | No authentication configured. |
32 | | `Plain` | 1 | PLAIN mechanism (username/password). |
33 | | `ScramSha256` | 2 | SCRAM-SHA-256 mechanism. |
34 | | `ScramSha512` | 3 | SCRAM-SHA-512 mechanism. |
35 | | `Gssapi` | 4 | Kerberos (GSSAPI) authentication. |
36 |
37 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.OnPrem/Functions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Azure.WebJobs;
2 | using System;
3 | using System.IO;
4 |
5 | namespace SimpleMessageBus.Samples.OnPrem
6 | {
7 |
8 | ///
9 | /// This class represents a set of test functions to ensure that Azure WebJobs works locally file FileTriggers.
10 | ///
11 | public class Functions
12 | {
13 |
14 | ///
15 | ///
16 | ///
17 | ///
18 | ///
19 | ///
20 | /// Drop a file in the "convert" directory, and this function will reverse the contents and write the file to the "converted" directory.
21 | ///
22 | public void Converter(
23 | [FileTrigger(@"convert\{name}", "*.txt", autoDelete: true)] string file,
24 | [File(@"converted\{name}", FileAccess.Write)] out string converted)
25 | {
26 | char[] arr = file.ToCharArray();
27 | Array.Reverse(arr);
28 | converted = new string(arr);
29 | }
30 |
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Core/AzureStorageQueueEncoding.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: AzureStorageQueueEncoding
3 | description: "Determines how QueueMessage.Body is represented in HTTP requests and responses."
4 | icon: list-ol
5 | tag: "ENUM"
6 | keywords: ['AzureStorageQueueEncoding', 'CloudNimble.SimpleMessageBus.Core.AzureStorageQueueEncoding', 'CloudNimble.SimpleMessageBus.Core', 'class', 'System.Enum']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Core.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Core
14 |
15 | **Inheritance:** System.Enum
16 |
17 | ## Syntax
18 |
19 | ```csharp
20 | CloudNimble.SimpleMessageBus.Core.AzureStorageQueueEncoding
21 | ```
22 |
23 | ## Summary
24 |
25 | Determines how QueueMessage.Body is represented in HTTP requests and responses.
26 |
27 | ## Values
28 |
29 | | Name | Value | Description |
30 | |------|-------|-------------|
31 | | `None` | 0 | The QueueMessage.Body is represented verbatim in HTTP requests and responses. I.e. message is not transformed. |
32 | | `Base64` | 1 | The QueueMessage.Body is represented as Base64 encoded string in HTTP requests and responses. |
33 |
34 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.IndexedDb.Core Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.IndexedDb.Core', 'namespace', 'IndexedDbConstants', 'IndexedDbOptions', 'SimpleMessageBusDb']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [IndexedDbConstants](/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbConstants) | A set of helpers to convert file system-related magic strings to compiled references. |
16 | | [IndexedDbOptions](/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/IndexedDbOptions) | Specifies the options required to leverage a browser's IndexedDB instance as the SimpleMessageBus backing queue. |
17 | | [SimpleMessageBusDb](/api-reference/CloudNimble/SimpleMessageBus/IndexedDb/Core/SimpleMessageBusDb) | Represents the IndexedDB database structure for SimpleMessageBus in Blazor WebAssembly applications. |
18 |
19 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Core/MessageEnvelopeTests.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using FluentAssertions;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 | using SimpleMessageBus.Tests.Shared;
5 |
6 | namespace SimpleMessageBus.Tests.Core
7 | {
8 |
9 | [TestClass]
10 | public class MessageEnvelopeTests
11 | {
12 |
13 | [TestMethod]
14 | public void MessageEnvelope_SerializesMessageContent()
15 | {
16 | var testMessage = new TestMessage
17 | {
18 | Greeting = "Hello world!",
19 | PickANumber = 42,
20 | BirthDay = new System.DateTime(1970, 4, 14)
21 | };
22 | testMessage.Id.Should().NotBeEmpty();
23 |
24 | var envelope = new MessageEnvelope(testMessage);
25 |
26 | envelope.MessageContent.Should().NotBeNullOrEmpty();
27 | envelope.MessageContent.Should().ContainAll(testMessage.Id.ToString(), testMessage.Greeting, testMessage.PickANumber.ToString(), testMessage.BirthDay.ToString("yyyy-MM-dd"));
28 | envelope.MessageType.Should().Contain(testMessage.GetType().FullName);
29 | }
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/SimpleMessageBus.Samples.Blazor.WebAssembly.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net10.0
6 | browser-wasm
7 | service-worker-assets.js
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/Kafka/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Publish.Kafka Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Publish.Kafka', 'namespace', 'IKafkaKeyProvider', 'KafkaMessagePublisher']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [KafkaMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/Kafka/KafkaMessagePublisher) | Manages the process of publishing MessageBus messages to Apache Kafka. |
16 |
17 | ### Interfaces
18 |
19 | | Name | Summary |
20 | | ---- | ------- |
21 | | [IKafkaKeyProvider](/api-reference/CloudNimble/SimpleMessageBus/Publish/Kafka/IKafkaKeyProvider) | Interface for providing Kafka message keys. Implement this on your [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) types to control message partitioning in Kafka. |
22 |
23 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Amazon.Core/SimpleMessageBus.Amazon.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Amazon.Core
5 | CloudNimble.SimpleMessageBus.Amazon.Core
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Core Library for Amazon
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events stored in Amazon through registered IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to dispatch events from Amazon through registered IMessageHandlers.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ### Summary
6 |
7 | *Replace: Short summary (3-5 sentences) describing the intention of the Pull Request.*
8 |
9 | ### Background and Detailed Information
10 |
11 | **Optional - Replace: Provide the reasoning behind the PR and any additional information that might help the maintainers of this repo process your PR.
12 | Feel free to included a bulleted list of the actual changes summarized*
13 |
14 | ### Associated Issues
15 |
16 | *Update: This pull request fixes #xxx.*
17 |
18 | ### Assemblies, Frameworks and Libraries
19 |
20 | *Replace: Detail which assemblies, frameworks and/or libraries are being affected by this PR. A bulleted list format is acceptable.*
21 |
22 | ### Checklist (Uncheck if it is not completed)
23 | *Add an 'X' to any applicable Checklist items.*
24 |
25 | - [ ] *N/A - Checklist review not required*
26 | - [ ] *Test cases added*
27 | - [ ] *Requires documentation updates*
28 | - [ ] *Build Validation Passed*
29 |
30 | ### Additional Information
31 |
32 | *Replace: If any additional information is required, please provide those details here.
33 | Feel free to include screenshots or related GitHub links.*
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Shared/TestMessage.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using System;
3 |
4 | namespace SimpleMessageBus.Tests.Shared
5 | {
6 |
7 | ///
8 | /// A test message for the publishers / dispatchers.
9 | ///
10 | public class TestMessage : IMessage
11 | {
12 |
13 | ///
14 | /// Message identifier.
15 | ///
16 | public Guid Id { get; set; }
17 |
18 | ///
19 | /// Default constructor that sets a unique value for the identifier.
20 | ///
21 | public TestMessage()
22 | {
23 | Id = Guid.NewGuid();
24 | }
25 |
26 | ///
27 | /// String value to test that all properties are being serialized correctly.
28 | ///
29 | public string Greeting { get; set; }
30 |
31 | ///
32 | /// Integer value to test that all properties are being serialized correctly.
33 | ///
34 | public int PickANumber { get; set; }
35 |
36 | ///
37 | /// DateTime value to test that all properties are being serialized correctly.
38 | ///
39 | public DateTime BirthDay { get; set; }
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.ExternalTriggers/SimpleMessageBus.Samples.ExternalTriggers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0;
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/IQueueProcessor.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IQueueProcessor
3 | description: "Defines the contract for queue processing components in the SimpleMessageBus system."
4 | icon: plug
5 | keywords: ['IQueueProcessor', 'CloudNimble.SimpleMessageBus.Dispatch.IQueueProcessor', 'CloudNimble.SimpleMessageBus.Dispatch', 'interface']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** CloudNimble.SimpleMessageBus.Dispatch.dll
11 |
12 | **Namespace:** CloudNimble.SimpleMessageBus.Dispatch
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | CloudNimble.SimpleMessageBus.Dispatch.IQueueProcessor
18 | ```
19 |
20 | ## Summary
21 |
22 | Defines the contract for queue processing components in the SimpleMessageBus system.
23 |
24 | ## Remarks
25 |
26 | This interface serves as a marker interface for queue processors, allowing for dependency injection
27 | registration and service discovery. Concrete implementations handle the specifics of reading messages
28 | from different queue providers (Azure, Amazon, FileSystem, etc.) and dispatching them to message handlers.
29 |
30 | The interface is intentionally empty to allow maximum flexibility in implementation while providing
31 | a common contract for the dependency injection system.
32 |
33 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Kafka/KafkaConstants.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// Constants for Kafka topic and consumer group configuration placeholders.
6 | ///
7 | public static class KafkaConstants
8 | {
9 |
10 | #region Properties
11 |
12 | ///
13 | /// WebJobs attribute placeholder for broker list resolution.
14 | ///
15 | public const string BrokerListAttribute = "%brokerlist%";
16 |
17 | ///
18 | /// WebJobs attribute placeholder for consumer group resolution.
19 | ///
20 | public const string ConsumerGroupAttribute = "%consumergroup%";
21 |
22 | ///
23 | /// Default consumer group name.
24 | ///
25 | public const string DefaultConsumerGroup = "simplemessagebus-consumer";
26 |
27 | ///
28 | /// Default topic name for SimpleMessageBus messages.
29 | ///
30 | public const string Topic = "simplemessagebus";
31 |
32 | ///
33 | /// WebJobs attribute placeholder for topic name resolution.
34 | ///
35 | public const string TopicTriggerAttribute = "%topic%";
36 |
37 | #endregion
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.FileSystem/Extensions/FileSystem_IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.Breakdance.Extensions.MSTest2;
2 | using CloudNimble.SimpleMessageBus.Core;
3 | using FluentAssertions;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using Microsoft.Extensions.Options;
7 | using Microsoft.VisualStudio.TestTools.UnitTesting;
8 |
9 | namespace SimpleMessageBus.Tests.Dispatch.FileSystem.Extensions
10 | {
11 |
12 | [TestClass]
13 | public class FileSystem_IHostBuilderExtensions : BreakdanceMSTestBase
14 | {
15 |
16 | [TestInitialize]
17 | public void Setup()
18 | {
19 | TestHostBuilder
20 | .UseEnvironment("Development")
21 | .UseFileSystemQueueProcessor()
22 | .UseOrderedMessageDispatcher();
23 | TestSetup();
24 | }
25 |
26 | [TestMethod]
27 | public void Configuration_CanFindFileSystemOptions()
28 | {
29 | var fileSystemOptions = TestHost.Services.GetService>().Value;
30 | fileSystemOptions.Should().NotBeNull();
31 | fileSystemOptions.RootFolder.Should().Be(@"C:\Temp\SimpleMessageBus");
32 | fileSystemOptions.VirusScanDelayInSeconds.Should().Be(0);
33 | }
34 |
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Publish Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Publish', 'namespace', 'FileSystemMessagePublisher', 'IMessagePublisher', 'AzureStorageQueueMessagePublisher']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [FileSystemMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/FileSystemMessagePublisher) | Manages the process of publishing MessageBus messages to the local file system. |
16 | | [AzureStorageQueueMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/AzureStorageQueueMessagePublisher) | Manages the process of publishing MessageBus messages to Azure Queue Storage. |
17 |
18 | ### Interfaces
19 |
20 | | Name | Summary |
21 | | ---- | ------- |
22 | | [IMessagePublisher](/api-reference/CloudNimble/SimpleMessageBus/Publish/IMessagePublisher) | Defines the functionality required for publishing an [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) to a supported backing queue. |
23 |
24 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Kafka/SimpleMessageBus.Publish.Kafka.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Publish.Kafka
5 | CloudNimble.SimpleMessageBus.Publish.Kafka
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Publisher for Kafka
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to publish Domain events to Apache Kafka topics.
15 |
16 |
17 | Version 6.0:
18 | - Initial release of Kafka publisher support using Confluent.Kafka client library.
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Package/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "CloudNimble, Inc.",
3 | "classifications": [
4 | "SimpleMessageBus"
5 | ],
6 | "name": "SimpleMessageBus Core + Dispatcher",
7 | "identity": "CloudNimble.SimpleMessageBus.Dispatch",
8 | "shortName": "simplemessagebus",
9 | "tags": {
10 | "language": "C#",
11 | "type": "project"
12 | },
13 | "preferNameDirectory": true,
14 | "sourceName": "CloudNimble.SimpleMessageBus.Templates",
15 | //"groupIdentity": "CloudNimble.EasyAF", // This is to differentiate between language templates
16 | "guids": [
17 | "42877D64-64FA-4587-821C-8DF3684D253D",
18 | "9ED207D3-9B63-44AC-88D8-8A49A598C6B4"
19 | ],
20 | "primaryOutputs": [
21 | {
22 | "path": "SimpleMessageBus.Templates.Core\\SimpleMessageBus.Templates.Core.csproj"
23 | },
24 | {
25 | "path": "SimpleMessageBus.Templates.Dispatch\\SimpleMessageBus.Dispatch.csproj"
26 | }
27 | ],
28 | "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.lock.json" ],
29 |
30 | "postActions": [
31 | {
32 | "condition": "(!skipRestore)",
33 | "description": "Restore NuGet packages required by this project.",
34 | "manualInstructions": [
35 | { "text": "Run 'dotnet restore'" }
36 | ],
37 | "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
38 | "continueOnError": true
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | SimpleMessageBus.Samples.Blazor
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 | An unhandled error has occurred.
29 |
Reload
30 |
🗙
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Kafka/SimpleMessageBus.Dispatch.Kafka.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch.Kafka
5 | CloudNimble.SimpleMessageBus.Dispatch.Kafka
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Dispatcher for Kafka
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events from Apache Kafka through registered IMessageHandlers.
15 |
16 |
17 | Version 6.0:
18 | - Initial release of Kafka dispatcher support using Azure WebJobs Kafka extension.
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Hosting/SimpleMessageBus.Hosting.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Hosting
5 | CloudNimble.SimpleMessageBus.Hosting
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Hosting
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package helps the
14 | SimpleMessageBus runtime execute in the right context whether it's running as a Console app or a Windows Service.
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/SimpleMessageBus.Docs.docsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mintlify
5 | true
6 | Folder
7 |
8 | true
9 | Samples;Templates
10 |
11 | false
12 | false
13 |
14 |
15 | SimpleMessageBus
16 | maple
17 |
18 | #419AC5
19 | #419AC5
20 | #3CD0E2
21 |
22 |
23 |
24 |
25 |
26 | index;why-simplemessagebus;quickstart
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish/IMessagePublisher.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using System;
3 | using System.Threading.Tasks;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Publish
6 | {
7 |
8 | ///
9 | /// Defines the functionality required for publishing an to a supported backing queue.
10 | ///
11 | ///
12 | /// Message publishers are the entry point for sending messages into the SimpleMessageBus system.
13 | /// Different implementations support various queue providers (Azure, Amazon, FileSystem, IndexedDB)
14 | /// while maintaining a consistent interface for application code.
15 | ///
16 | public interface IMessagePublisher
17 | {
18 |
19 | ///
20 | /// Publishes the specified to a queue.
21 | ///
22 | /// The message to add to the queue.
23 | ///
24 | /// Specifies whether the message comes from the currently-authenticated user, or is a system-generated message.
25 | /// This flag can be used for auditing, routing, or processing decisions.
26 | ///
27 | /// A task representing the asynchronous publish operation.
28 | /// Thrown when is null.
29 | Task PublishAsync(IMessage message, bool isSystemGenerated = false);
30 |
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/System/Type.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Type
3 | description: "Extension methods for Type from System.Runtime"
4 | icon: file-brackets-curly
5 | keywords: ['Type', 'System.Type', 'System', 'error']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** System.Runtime.dll
11 |
12 | **Namespace:** System
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | System.Type
18 | ```
19 |
20 | ## Summary
21 |
22 | This type is defined in System.Runtime.
23 |
24 | ## Remarks
25 |
26 | See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/system.type) for more information about the rest of the API.
27 |
28 | ## Methods
29 |
30 | ### SimpleAssemblyQualifiedName Extension
31 |
32 | Extension method from `System.TypeExtensions`
33 |
34 | Guarantees the creation of an AssemblyQualifiedName that does not contain version or key details. That way when AssemblyVersions are incremented,
35 | the system will still attempt to process the [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage).
36 |
37 | #### Syntax
38 |
39 | ```csharp
40 | public static string SimpleAssemblyQualifiedName(System.Type type)
41 | ```
42 |
43 | #### Parameters
44 |
45 | | Name | Type | Description |
46 | |------|------|-------------|
47 | | `type` | `System.Type` | - |
48 |
49 | #### Returns
50 |
51 | Type: `string`
52 | A string containing the *type* name in the format "FullTypeName, SimpleAssemblyName".
53 |
54 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Amazon/SimpleMessageBus.Publish.Amazon.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Publish.Amazon
5 | CloudNimble.SimpleMessageBus.Publish.Amazon
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Publisher for Amazon
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to cycle through Domain events stored in Amazon and dispatch them to IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to publish events to Amazon event stores.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Layout/NavMenu.razor:
--------------------------------------------------------------------------------
1 |
9 |
10 |
29 |
30 | @code {
31 | private bool collapseNavMenu = true;
32 |
33 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
34 |
35 | private void ToggleNavMenu()
36 | {
37 | collapseNavMenu = !collapseNavMenu;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.Kafka/KafkaProcessorTests.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using CloudNimble.SimpleMessageBus.Dispatch;
3 | using CloudNimble.SimpleMessageBus.Dispatch.Kafka;
4 | using FluentAssertions;
5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
6 |
7 | namespace SimpleMessageBus.Tests.Dispatch.Kafka
8 | {
9 |
10 | ///
11 | /// Integration tests for Kafka processor.
12 | ///
13 | ///
14 | /// These tests require a running Kafka instance. Use Testcontainers.Kafka
15 | /// to spin up a container, or configure connection to an existing cluster.
16 | ///
17 | [TestClass]
18 | public class KafkaProcessorTests
19 | {
20 |
21 | // TODO: Implement integration tests using Testcontainers.Kafka
22 | // when Docker-based testing infrastructure is available.
23 | //
24 | // Test scenarios to implement:
25 | // 1. MessagePublisher_PublishesMessage_ToKafkaTopic
26 | // 2. KafkaProcessor_ProcessesMessage_DispatchesToHandler
27 | // 3. KafkaProcessor_WithKey_RoutesToCorrectPartition
28 | // 4. KafkaProcessor_OnFailure_DoesNotCommitOffset
29 |
30 | ///
31 | /// Verifies that implements .
32 | ///
33 | [TestMethod]
34 | public void KafkaProcessor_ImplementsIQueueProcessor()
35 | {
36 | typeof(KafkaProcessor).Should().Implement();
37 | }
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Pages/Weather.razor:
--------------------------------------------------------------------------------
1 | @page "/weather"
2 | @inject HttpClient Http
3 |
4 | Weather
5 |
6 | Weather
7 |
8 | This component demonstrates fetching data from the server.
9 |
10 | @if (forecasts == null)
11 | {
12 | Loading...
13 | }
14 | else
15 | {
16 |
17 |
18 |
19 | | Date |
20 | Temp. (C) |
21 | Temp. (F) |
22 | Summary |
23 |
24 |
25 |
26 | @foreach (var forecast in forecasts)
27 | {
28 |
29 | | @forecast.Date.ToShortDateString() |
30 | @forecast.TemperatureC |
31 | @forecast.TemperatureF |
32 | @forecast.Summary |
33 |
34 | }
35 |
36 |
37 | }
38 |
39 | @code {
40 | private WeatherForecast[] forecasts;
41 |
42 | protected override async Task OnInitializedAsync()
43 | {
44 | forecasts = await Http.GetFromJsonAsync("sample-data/weather.json");
45 | }
46 |
47 | public class WeatherForecast
48 | {
49 | public DateOnly Date { get; set; }
50 |
51 | public int TemperatureC { get; set; }
52 |
53 | public string Summary { get; set; }
54 |
55 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/SimpleMessageBus.Dispatch.FileSystem.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch.FileSystem
5 | CloudNimble.SimpleMessageBus.Dispatch.FileSystem
6 | net10.0;net9.0;net8.0;
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Dispatcher for Local FileSystems
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events stored in local or network storage through registered IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to dispatch events from local or network event stores.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Core/NewUserMessage.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using System;
3 |
4 | namespace SimpleMessageBus.Samples.Core
5 | {
6 |
7 | ///
8 | /// An signifying that a new user has registered with the system.
9 | ///
10 | ///
11 | /// This is the kind of message that would be typical with any app. When a new user registers, you might want to do something like:
12 | /// 1) Register a conversion in your SaaS metrics app.
13 | /// 2) Send them a welcome email.
14 | /// 3) Send yourself a test message letting you know you have a new signup.
15 | ///
16 | public class NewUserMessage : MessageBase
17 | {
18 |
19 | #region Properties
20 |
21 | ///
22 | /// The email address of the user that registered.
23 | ///
24 | public string Email { get; set; }
25 |
26 | #endregion
27 |
28 | #region Constructors
29 |
30 | ///
31 | /// Creates a new instance of the .
32 | ///
33 | public NewUserMessage() : base()
34 | {
35 | }
36 |
37 | ///
38 | /// Creates a new instance of the as a child of another message.
39 | ///
40 | /// The parent message to inherit metadata from.
41 | public NewUserMessage(IMessage parent) : base(parent)
42 | {
43 | }
44 |
45 | #endregion
46 |
47 | }
48 |
49 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | icon: cubes
4 | mode: wide
5 | ---
6 |
7 | ## Namespaces
8 |
9 | - [CloudNimble.SimpleMessageBus.Amazon.Core](CloudNimble/SimpleMessageBus/Amazon/Core)
10 | - [CloudNimble.SimpleMessageBus.Breakdance](CloudNimble/SimpleMessageBus/Breakdance)
11 | - [CloudNimble.SimpleMessageBus.Core](CloudNimble/SimpleMessageBus/Core)
12 | - [System](System)
13 | - [System.Collections.Concurrent](System/Collections/Concurrent)
14 | - [CloudNimble.SimpleMessageBus.Dispatch](CloudNimble/SimpleMessageBus/Dispatch)
15 | - [Microsoft.Extensions.Hosting](Microsoft/Extensions/Hosting)
16 | - [CloudNimble.SimpleMessageBus.Dispatch.Amazon](CloudNimble/SimpleMessageBus/Dispatch/Amazon)
17 | - [CloudNimble.SimpleMessageBus.Dispatch.Triggers](CloudNimble/SimpleMessageBus/Dispatch/Triggers)
18 | - [Microsoft.Azure.WebJobs](Microsoft/Azure/WebJobs)
19 | - [CloudNimble.SimpleMessageBus.Dispatch.IndexedDb](CloudNimble/SimpleMessageBus/Dispatch/IndexedDb)
20 | - [CloudNimble.SimpleMessageBus.Dispatch.Kafka](CloudNimble/SimpleMessageBus/Dispatch/Kafka)
21 | - [CloudNimble.SimpleMessageBus.IndexedDb.Core](CloudNimble/SimpleMessageBus/IndexedDb/Core)
22 | - [CloudNimble.SimpleMessageBus.Publish](CloudNimble/SimpleMessageBus/Publish)
23 | - [CloudNimble.SimpleMessageBus.Publish.Amazon](CloudNimble/SimpleMessageBus/Publish/Amazon)
24 | - [CloudNimble.SimpleMessageBus.Publish.IndexedDb](CloudNimble/SimpleMessageBus/Publish/IndexedDb)
25 | - [Microsoft.AspNetCore.Components.WebAssembly.Hosting](Microsoft/AspNetCore/Components/WebAssembly/Hosting)
26 | - [CloudNimble.SimpleMessageBus.Publish.Kafka](CloudNimble/SimpleMessageBus/Publish/Kafka)
27 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Amazon/SimpleMessageBus.Dispatch.Amazon.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch.Amazon
5 | CloudNimble.SimpleMessageBus.Dispatch.Amazon
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Dispatcher for Amazon
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events stored in Amazon through registered IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to dispatch events from Amazon through registered IMessageHandlers.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/IMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CloudNimble.SimpleMessageBus.Core
4 | {
5 |
6 | ///
7 | /// Defines the required composition of every Message published to the SimpleMessageBus.
8 | ///
9 | ///
10 | /// All messages in the SimpleMessageBus system must implement this interface. The Id property ensures
11 | /// that each message can be uniquely identified throughout its lifecycle, including during processing,
12 | /// error handling, and when moved to poison queues.
13 | ///
14 | ///
15 | ///
16 | /// public class OrderCreatedMessage : IMessage
17 | /// {
18 | /// public Guid Id { get; set; } = Guid.NewGuid();
19 | /// public string OrderNumber { get; set; }
20 | /// public decimal TotalAmount { get; set; }
21 | /// public DateTime CreatedAt { get; set; }
22 | /// }
23 | ///
24 | ///
25 | public interface IMessage
26 | {
27 |
28 | ///
29 | /// Gets or sets the unique identifier for this Message.
30 | ///
31 | ///
32 | /// A that uniquely identifies this message instance. This value should be set when
33 | /// the message is created and remain constant throughout the message's lifetime.
34 | ///
35 | ///
36 | /// This identifier is used for tracking messages through the system, deduplication, and correlating
37 | /// messages in poison queues with their original instances.
38 | ///
39 | Guid Id { get; set; }
40 |
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Azure/SimpleMessageBus.Publish.Azure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Publish.Azure
5 | CloudNimble.SimpleMessageBus.Publish.Azure
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Publisher for Azure
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to cycle through Domain events stored in Azure and dispatch them to IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to publish events to Azure event stores.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/snippets/DocsBadge.jsx:
--------------------------------------------------------------------------------
1 | /**
2 | * DocsBadge Component for Mintlify Documentation
3 | *
4 | * A customizable badge component that matches Mintlify's design system.
5 | * Used to display member provenance (Extension, Inherited, Override, Virtual, Abstract).
6 | *
7 | * Usage:
8 | *
9 | *
10 | *
11 | *
12 | *
13 | */
14 |
15 | export function DocsBadge({ text, variant = 'neutral' }) {
16 | // Tailwind color classes for consistent theming
17 | // Using standard Tailwind colors that work in both light and dark modes
18 | const variantClasses = {
19 | success: 'mint-bg-green-500/10 mint-text-green-600 dark:mint-text-green-400 mint-border-green-500/20',
20 | neutral: 'mint-bg-slate-500/10 mint-text-slate-600 dark:mint-text-slate-400 mint-border-slate-500/20',
21 | info: 'mint-bg-blue-500/10 mint-text-blue-600 dark:mint-text-blue-400 mint-border-blue-500/20',
22 | warning: 'mint-bg-amber-500/10 mint-text-amber-600 dark:mint-text-amber-400 mint-border-amber-500/20',
23 | danger: 'mint-bg-red-500/10 mint-text-red-600 dark:mint-text-red-400 mint-border-red-500/20'
24 | };
25 |
26 | const classes = variantClasses[variant] || variantClasses.neutral;
27 |
28 | return (
29 |
32 | {text}
33 |
34 | );
35 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/FilesOptionsConfiguration.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Azure.WebJobs.Extensions.Files;
3 | using Microsoft.Extensions.Options;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Dispatch
6 | {
7 |
8 | ///
9 | /// Leverages the DI framework to make the injected available to the to the default values can be set.
10 | ///
11 | ///
12 | /// From https://benjamincollins.com/blog/using-dependency-injection-while-configuring-services/
13 | ///
14 | internal class FilesOptionsConfiguration : IConfigureOptions
15 | {
16 |
17 | #region Private Members
18 |
19 | private readonly IOptions _fileSystemOptions;
20 |
21 | #endregion
22 |
23 | #region Constructors
24 |
25 | ///
26 | /// The default constructor.
27 | ///
28 | ///
29 | public FilesOptionsConfiguration(IOptions fileSystemOptions)
30 | {
31 | _fileSystemOptions = fileSystemOptions;
32 | }
33 |
34 | #endregion
35 |
36 | #region Public Methods
37 |
38 | ///
39 | /// Configures a given object with the passed-in values from .
40 | ///
41 | ///
42 | public void Configure(FilesOptions options)
43 | {
44 | options.RootPath = _fileSystemOptions.Value.RootFolder;
45 | }
46 |
47 | #endregion
48 |
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.AzureWebJobs/Program.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 |
6 | namespace SimpleMessageBus.Samples.AzureWebJobs
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var builder = Host.CreateDefaultBuilder()
13 | // RWM: Configure the services *before* you call Use____QueueProcessor so that the assembly is loaded into memory before the WebJobs' Reflection happens.
14 | .ConfigureServices((hostContext, services) =>
15 | {
16 | services.AddTimerDependencies();
17 | services.AddSingleton();
18 | })
19 | .UseAzureStorageQueueMessagePublisher()
20 | .UseAzureStorageQueueProcessor(options => options.ConcurrentJobs = 1)
21 | .UseOrderedMessageDispatcher()
22 | .ConfigureLogging((context, b) =>
23 | {
24 | b.SetMinimumLevel(LogLevel.Debug);
25 | b.AddConsole();
26 | string instrumentationKey = context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
27 | if (!string.IsNullOrEmpty(instrumentationKey))
28 | {
29 | b.AddApplicationInsightsWebJobs(o => o.InstrumentationKey = instrumentationKey);
30 | }
31 | });
32 |
33 | builder.UseSimpleMessageBusLifetime();
34 |
35 | var host = builder.Build();
36 | using (host)
37 | host.Run();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.IndexedDb.Core/SimpleMessageBus.IndexedDb.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.IndexedDb.Core
5 | CloudNimble.SimpleMessageBus.IndexedDb.Core
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Core Framework for Blazor IndexedDb
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to create and manage the browser's IndexedDb SimpleMessageBus instance.
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.IndexedDb/SimpleMessageBus.Publish.IndexedDb.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Publish.IndexedDb
5 | CloudNimble.SimpleMessageBus.Publish.IndexedDb
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 | $(NoWarn);CS8002
9 |
10 |
11 |
12 | SimpleMessageBus Publisher for Blazor IndexedDb
13 |
14 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
15 | the logic necessary to publish Domain events to the browser's IndexedDb instance.
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.Blazor.WebAssembly/Layout/MainLayout.razor.css:
--------------------------------------------------------------------------------
1 | .page {
2 | position: relative;
3 | display: flex;
4 | flex-direction: column;
5 | }
6 |
7 | main {
8 | flex: 1;
9 | }
10 |
11 | .sidebar {
12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13 | }
14 |
15 | .top-row {
16 | background-color: #f7f7f7;
17 | border-bottom: 1px solid #d6d5d5;
18 | justify-content: flex-end;
19 | height: 3.5rem;
20 | display: flex;
21 | align-items: center;
22 | }
23 |
24 | .top-row ::deep a, .top-row ::deep .btn-link {
25 | white-space: nowrap;
26 | margin-left: 1.5rem;
27 | text-decoration: none;
28 | }
29 |
30 | .top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31 | text-decoration: underline;
32 | }
33 |
34 | .top-row ::deep a:first-child {
35 | overflow: hidden;
36 | text-overflow: ellipsis;
37 | }
38 |
39 | @media (max-width: 640.98px) {
40 | .top-row {
41 | justify-content: space-between;
42 | }
43 |
44 | .top-row ::deep a, .top-row ::deep .btn-link {
45 | margin-left: 0;
46 | }
47 | }
48 |
49 | @media (min-width: 641px) {
50 | .page {
51 | flex-direction: row;
52 | }
53 |
54 | .sidebar {
55 | width: 250px;
56 | height: 100vh;
57 | position: sticky;
58 | top: 0;
59 | }
60 |
61 | .top-row {
62 | position: sticky;
63 | top: 0;
64 | z-index: 1;
65 | }
66 |
67 | .top-row.auth ::deep a:first-child {
68 | flex: 1;
69 | text-align: right;
70 | width: 0;
71 | }
72 |
73 | .top-row, article {
74 | padding-left: 2rem !important;
75 | padding-right: 1.5rem !important;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/Extensions/DependencyInjection/IServiceCollection.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IServiceCollection
3 | description: "Extension methods for IServiceCollection from Microsoft.Extensions.DependencyInjection.Abstractions"
4 | icon: file-brackets-curly
5 | keywords: ['IServiceCollection', 'Microsoft.Extensions.DependencyInjection.IServiceCollection', 'Microsoft.Extensions.DependencyInjection', 'error']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** Microsoft.Extensions.DependencyInjection.Abstractions.dll
11 |
12 | **Namespace:** Microsoft.Extensions.DependencyInjection
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | Microsoft.Extensions.DependencyInjection.IServiceCollection
18 | ```
19 |
20 | ## Summary
21 |
22 | This type is defined in Microsoft.Extensions.DependencyInjection.Abstractions.
23 |
24 | ## Remarks
25 |
26 | See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) for more information about the rest of the API.
27 |
28 | ## Methods
29 |
30 | ### AddTimerDependencies Extension
31 |
32 | Extension method from `Microsoft.Extensions.DependencyInjection.IServiceCollectionExtensions`
33 |
34 | #### Syntax
35 |
36 | ```csharp
37 | public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddTimerDependencies(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
38 | ```
39 |
40 | #### Parameters
41 |
42 | | Name | Type | Description |
43 | |------|------|-------------|
44 | | `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | - |
45 |
46 | #### Returns
47 |
48 | Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
49 |
50 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report_request.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Report a bug that needs to get addressed 🐜
3 | title: "[BUG]: "
4 | labels: ["Bug Report"]
5 | assignees: ["robertmclaws"]
6 | body:
7 | - type: markdown
8 | attributes:
9 | value: |
10 | Thank you for creating an issue with one of our CloudNimble, Inc. repos.
11 | Please ensure that any
12 |
13 | - type: textarea
14 | id: bug-description
15 | attributes:
16 | label: Description of the Bug
17 | description: Provide a brief description how the bug occurs and where the bug can be found.
18 | validations:
19 | required: true
20 |
21 | - type: textarea
22 | id: bug-expected-result
23 | attributes:
24 | label: Expected Result
25 | description: What would happen if there wasn't a bug.
26 | validations:
27 | required: true
28 |
29 | - type: textarea
30 | id: bug-actual-result
31 | attributes:
32 | label: Actual Result
33 | description: What is actually happening.
34 | validations:
35 | required: true
36 |
37 | - type: textarea
38 | id: bug-reproduce-steps
39 | attributes:
40 | label: Reproduce steps
41 | description: Steps to reproduce the behavior.
42 | placeholder: |
43 | 1. Go to '...'
44 | 2. Click on '...'
45 | 3. Scroll down to '...'
46 | 4. Select '...'
47 | 5. See error
48 | validations:
49 | required: true
50 |
51 | - type: textarea
52 | id: bug-additional-info
53 | attributes:
54 | label: Additional Bug Details
55 | description: |
56 | Provide any additional information regarding the specific bug. This can include supporting information such as logs, screenshots or videos illsturate how the bug occurs so that we can facilitate resolving the issue.
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Azure/SimpleMessageBus.Dispatch.Azure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch.Azure
5 | CloudNimble.SimpleMessageBus.Dispatch.Azure
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Dispatcher for Azure
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events stored in Azure through registered IMessageHandlers.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. This package now
19 | contains the required logic to dispatch events from Azure through registered IMessageHandlers.
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Kafka/IKafkaKeyProvider.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 |
3 | namespace CloudNimble.SimpleMessageBus.Publish.Kafka
4 | {
5 |
6 | ///
7 | /// Interface for providing Kafka message keys. Implement this on your
8 | /// types to control message partitioning in Kafka.
9 | ///
10 | ///
11 | ///
12 | /// Kafka uses message keys to determine which partition a message goes to. Messages with
13 | /// the same key always go to the same partition, ensuring ordering for related messages.
14 | ///
15 | ///
16 | /// Common use cases:
17 | ///
18 | ///
19 | /// - Use a customer ID as key to ensure all events for a customer are processed in order
20 | /// - Use an order ID to keep all order-related events together
21 | /// - Use a tenant ID in multi-tenant systems
22 | ///
23 | ///
24 | ///
25 | ///
26 | /// public class OrderUpdatedMessage : MessageBase, IKafkaKeyProvider
27 | /// {
28 | /// public string OrderId { get; set; }
29 | /// public string GetKafkaKey() => OrderId;
30 | /// }
31 | ///
32 | ///
33 | public interface IKafkaKeyProvider
34 | {
35 |
36 | ///
37 | /// Gets the Kafka message key for partition routing.
38 | ///
39 | ///
40 | /// A string key that determines partition assignment. Return null to use
41 | /// round-robin partitioning (no ordering guarantee).
42 | ///
43 | string GetKafkaKey();
44 |
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch/IMessageDispatcher.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using System.Threading.Tasks;
3 |
4 | namespace CloudNimble.SimpleMessageBus.Dispatch
5 | {
6 |
7 | ///
8 | /// Defines the required composition of every Dispatcher used by SimpleMessageBus to send MessageEnvelopes to the
9 | /// IMessageHandlers registered to handle that message's .
10 | ///
11 | ///
12 | /// Message dispatchers control how messages are delivered to their handlers. SimpleMessageBus provides two built-in
13 | /// implementations: for sequential processing and
14 | /// for concurrent processing. Custom dispatchers can be implemented for specialized routing or processing logic.
15 | ///
16 | public interface IMessageDispatcher
17 | {
18 |
19 | ///
20 | /// Dispatches an incoming to the IMessageHandlers registered to handle that message's .
21 | ///
22 | /// The instance to send to the registered IMessageHandlers.
23 | /// A reference for the asynchronous function.
24 | ///
25 | /// The implementation determines how handlers are invoked - sequentially, in parallel, or using custom logic.
26 | /// All matching handlers (those that declare support for the message type) will be called.
27 | ///
28 | Task Dispatch(MessageEnvelope messageEnvelope);
29 |
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch/SimpleMessageBus.Dispatch.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch
5 | CloudNimble.SimpleMessageBus.Dispatch
6 | net10.0;net9.0;net8.0;
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus.Dispatch
12 | SimpleMessageBus Dispatch Framework
13 |
14 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package is
15 | installed in your Runtime app to automatically process your Queues and call your registered IMessageHandlers.
16 |
17 |
18 | Version 5.0:
19 | - Changed the architecture to split out event stores in order to expand our capabilities. If you were using
20 | Azure or File System targets, you will need to change your Dispatch PackageReferences to use
21 | the ones with the .Azure or .FileSystem suffix instead.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.IndexedDb/Extensions/WebAssemblyHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.BlazorEssentials.IndexedDb;
2 | using CloudNimble.SimpleMessageBus.IndexedDb.Core;
3 | using CloudNimble.SimpleMessageBus.Publish;
4 | using CloudNimble.SimpleMessageBus.Publish.IndexedDb;
5 | using Microsoft.Extensions.DependencyInjection;
6 | using System;
7 |
8 | namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting
9 | {
10 |
11 | ///
12 | ///
13 | ///
14 | public static class SimpleMessageBus_Publish_IndexedDb_WebAssemblyHostBuilderExtensions
15 | {
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 | public static void UseIndexedDbMessagePublisher(this WebAssemblyHostBuilder builder, string configSectionName = "SimpleMessageBus:IndexedDb",
24 | Action indexedDbOptions = null)
25 | {
26 | ArgumentNullException.ThrowIfNull(builder);
27 |
28 | var config = builder.Configuration.GetSection(configSectionName);
29 | if (config is null && indexedDbOptions is null)
30 | {
31 | builder.Services.AddOptions();
32 | }
33 |
34 | if (config is not null)
35 | {
36 | builder.Services.Configure(config);
37 | }
38 |
39 | if (indexedDbOptions is not null)
40 | {
41 | builder.Services.Configure(indexedDbOptions);
42 | }
43 |
44 | builder.Services.AddSingleton();
45 | builder.Services.AddSingleton();
46 | }
47 |
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish/SimpleMessageBus.Publish.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Publish
5 | CloudNimble.SimpleMessageBus.Publish
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Publisher
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package allows
14 | client APIs and apps to publish domain messages onto the SimpleMessageBus queue while using minimal dependencies.
15 |
16 |
17 | Version 5.0:
18 | - Changed the architecture to split out event stores in order to expand our capabilities. If you were using
19 | Azure targets, you will need to change your Dispatch PackageReferences to use SimpleMessageBus.Publish.Azure
20 | instead (the FileSystem publisher is still in this package).
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Listener/StatusFileEntry.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | using System;
5 | using System.IO;
6 | using Newtonsoft.Json;
7 | using Newtonsoft.Json.Converters;
8 |
9 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
10 | {
11 |
12 | ///
13 | /// Represents a single status entry in the status file.
14 | ///
15 | internal class StatusFileEntry
16 | {
17 |
18 | ///
19 | /// Gets or sets the current
20 | ///
21 | [JsonConverter(typeof(StringEnumConverter))]
22 | public ProcessingState State { get; set; }
23 |
24 | ///
25 | /// Gets or sets the timestamp of the entry.
26 | ///
27 | public DateTime Timestamp { get; set; }
28 |
29 | ///
30 | /// Gets or sets the timestamp of the last write to the target file.
31 | ///
32 | public DateTime LastWrite { get; set; }
33 |
34 | ///
35 | /// Gets or sets the enumeration value indicating
36 | /// which type of file operation this entry is for.
37 | ///
38 | [JsonConverter(typeof(StringEnumConverter))]
39 | public WatcherChangeTypes ChangeType { get; set; }
40 |
41 | ///
42 | /// Gets or sets the ID of the instance that created this entry.
43 | ///
44 | public string InstanceId { get; set; }
45 |
46 | ///
47 | /// Gets or sets the number of times processing for the the file
48 | /// for this entry has been attempted.
49 | ///
50 | public int ProcessCount { get; set; }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/SimpleMessageBus.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Core
5 | CloudNimble.SimpleMessageBus.Core
6 | net10.0;net9.0;net8.0;
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus.Core
12 | SimpleMessageBus Core Framework
13 |
14 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
15 | the core objects necessary to construct a Domain event system with minimal dependencies.
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Hosting/Extensions/IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Hosting.Internal;
2 | using Microsoft.Extensions.Hosting.WindowsServices;
3 |
4 | namespace Microsoft.Extensions.Hosting
5 | {
6 |
7 | ///
8 | /// A set of extension methods that make it easy to register SimpleMessageBus with a DI container.
9 | ///
10 | ///
11 | /// These extensions provide hosting utilities for SimpleMessageBus applications, particularly for scenarios
12 | /// where the application needs to run as either a Windows Service or a console application depending on
13 | /// the execution context.
14 | ///
15 | public static class SimpleMessageBus_Hosting_IHostBuilderExtensions
16 | {
17 |
18 | ///
19 | /// Configures SimpleMessageBus to use either the or the depending on the currently-running context.
20 | ///
21 | /// The instance to extend.
22 | /// The instance being configured, for fluent interaction.
23 | ///
24 | /// This method automatically detects whether the application is running as a Windows Service
25 | /// and configures the appropriate lifetime management. This enables the same application
26 | /// to run seamlessly in both development (console) and production (service) environments.
27 | ///
28 | public static IHostBuilder UseSimpleMessageBusLifetime(this IHostBuilder builder)
29 | {
30 | if (WindowsServiceHelpers.IsWindowsService())
31 | {
32 | builder.UseWindowsService();
33 | }
34 | else
35 | {
36 | builder.UseConsoleLifetime();
37 | }
38 | return builder;
39 | }
40 |
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/IKafkaKeyProvider.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IKafkaKeyProvider
3 | description: "Interface for providing Kafka message keys. Implement this on your [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) types to..."
4 | icon: plug
5 | keywords: ['IKafkaKeyProvider', 'CloudNimble.SimpleMessageBus.Publish.IKafkaKeyProvider', 'CloudNimble.SimpleMessageBus.Publish', 'interface']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** CloudNimble.SimpleMessageBus.Publish.Kafka.dll
11 |
12 | **Namespace:** CloudNimble.SimpleMessageBus.Publish
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | CloudNimble.SimpleMessageBus.Publish.IKafkaKeyProvider
18 | ```
19 |
20 | ## Summary
21 |
22 | Interface for providing Kafka message keys. Implement this on your [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage)
23 | types to control message partitioning in Kafka.
24 |
25 | ## Remarks
26 |
27 |
28 |
29 |
30 | Kafka uses message keys to determine which partition a message goes to. Messages with
31 | the same key always go to the same partition, ensuring ordering for related messages.
32 |
33 |
34 |
35 |
36 |
37 | Common use cases:
38 |
39 |
40 |
41 |
42 |
43 | ## Examples
44 |
45 | ```csharp
46 | public class OrderUpdatedMessage : MessageBase, IKafkaKeyProvider
47 | {
48 | public string OrderId { get; set; }
49 | public string GetKafkaKey() => OrderId;
50 | }
51 | ```
52 |
53 | ## Methods
54 |
55 | ### GetKafkaKey Abstract
56 |
57 | Gets the Kafka message key for partition routing.
58 |
59 | #### Syntax
60 |
61 | ```csharp
62 | string GetKafkaKey()
63 | ```
64 |
65 | #### Returns
66 |
67 | Type: `string`
68 | A string key that determines partition assignment. Return `null` to use
69 | round-robin partitioning (no ordering guarantee).
70 |
71 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/QueueProcessors/FileSystemNameResolver.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Azure.WebJobs;
3 | using Microsoft.Extensions.Options;
4 | using System;
5 |
6 | namespace CloudNimble.SimpleMessageBus.Dispatch
7 | {
8 |
9 | ///
10 | /// Helps dynamically resolve the name of the configured Queue at runtime.
11 | ///
12 | /// See https://github.com/Azure/azure-webjobs-sdk/wiki/Queues#set-values-for-webjobs-sdk-constructor-parameters-in-code.
13 | internal class FileSystemNameResolver : INameResolver
14 | {
15 |
16 | #region Private Members
17 |
18 | private FileSystemOptions _options;
19 |
20 | #endregion
21 |
22 | #region Constructors
23 |
24 | ///
25 | /// Creates a new instance of the
26 | ///
27 | /// The instance injected from the DI container.
28 | public FileSystemNameResolver(IOptions options)
29 | {
30 | _options = options.Value;
31 | }
32 |
33 | ///
34 | /// Resolves folder paths for file system operations based on configuration.
35 | ///
36 | /// The placeholder name to resolve (queue, completed, or error).
37 | /// The actual folder path from configuration.
38 | public string Resolve(string name)
39 | {
40 | return name switch
41 | {
42 | var n when string.Equals(n, FileSystemConstants.Completed, StringComparison.OrdinalIgnoreCase) => _options.CompletedFolderPath,
43 | var n when string.Equals(n, FileSystemConstants.Error, StringComparison.OrdinalIgnoreCase) => _options.ErrorFolderPath,
44 | _ => _options.QueueFolderPath,
45 | };
46 | }
47 |
48 | #endregion
49 |
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/Kafka/IKafkaKeyProvider.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IKafkaKeyProvider
3 | description: "Interface for providing Kafka message keys. Implement this on your [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) types to..."
4 | icon: plug
5 | keywords: ['IKafkaKeyProvider', 'CloudNimble.SimpleMessageBus.Publish.Kafka.IKafkaKeyProvider', 'CloudNimble.SimpleMessageBus.Publish.Kafka', 'interface']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** CloudNimble.SimpleMessageBus.Publish.Kafka.dll
11 |
12 | **Namespace:** CloudNimble.SimpleMessageBus.Publish.Kafka
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | CloudNimble.SimpleMessageBus.Publish.Kafka.IKafkaKeyProvider
18 | ```
19 |
20 | ## Summary
21 |
22 | Interface for providing Kafka message keys. Implement this on your [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage)
23 | types to control message partitioning in Kafka.
24 |
25 | ## Remarks
26 |
27 |
28 |
29 |
30 | Kafka uses message keys to determine which partition a message goes to. Messages with
31 | the same key always go to the same partition, ensuring ordering for related messages.
32 |
33 |
34 |
35 |
36 |
37 | Common use cases:
38 |
39 |
40 |
41 |
42 |
43 | ## Examples
44 |
45 | ```csharp
46 | public class OrderUpdatedMessage : MessageBase, IKafkaKeyProvider
47 | {
48 | public string OrderId { get; set; }
49 | public string GetKafkaKey() => OrderId;
50 | }
51 | ```
52 |
53 | ## Methods
54 |
55 | ### GetKafkaKey Abstract
56 |
57 | Gets the Kafka message key for partition routing.
58 |
59 | #### Syntax
60 |
61 | ```csharp
62 | string GetKafkaKey()
63 | ```
64 |
65 | #### Returns
66 |
67 | Type: `string`
68 | A string key that determines partition assignment. Return `null` to use
69 | round-robin partitioning (no ordering guarantee).
70 |
71 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Azure/QueuesOptionsConfiguration.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Azure.WebJobs.Host;
3 | using Microsoft.Extensions.Options;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Dispatch
6 | {
7 |
8 | ///
9 | /// Leverages the DI framework to make the injected available to the QueuesOptions to the default values can be set.
10 | ///
11 | ///
12 | /// From https://benjamincollins.com/blog/using-dependency-injection-while-configuring-services/
13 | ///
14 | internal class QueuesOptionsConfiguration : IConfigureOptions
15 | {
16 |
17 | #region Private Members
18 |
19 | private readonly IOptions _azureStorageQueueOptions;
20 |
21 | #endregion
22 |
23 | #region Constructors
24 |
25 | ///
26 | /// Initializes a new instance of the class.
27 | ///
28 | /// The Azure Storage Queue options to use for configuration.
29 | public QueuesOptionsConfiguration(IOptions azureStorageQueueOptions)
30 | {
31 | _azureStorageQueueOptions = azureStorageQueueOptions;
32 | }
33 |
34 | #endregion
35 |
36 | #region Public Methods
37 |
38 | ///
39 | /// Configures a given QueuesOptions object with the passed-in values from .
40 | ///
41 | /// The QueuesOptions instance to configure.
42 | public void Configure(QueuesOptions options)
43 | {
44 | options.BatchSize = _azureStorageQueueOptions.Value.ConcurrentJobs;
45 | options.MessageEncoding = (Azure.Storage.Queues.QueueMessageEncoding)(int)_azureStorageQueueOptions.Value.MessageEncoding;
46 | }
47 |
48 | #endregion
49 |
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.IndexedDb/SimpleMessageBus.Dispatch.IndexedDb.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CloudNimble.SimpleMessageBus.Dispatch.IndexedDb
5 | CloudNimble.SimpleMessageBus.Dispatch.IndexedDb
6 | net10.0;net9.0;net8.0
7 | $(DocumentationFile)\$(AssemblyName).xml
8 |
9 |
10 |
11 | SimpleMessageBus Dispatcher for Blazor IndexedDb
12 |
13 | A framework for reliable, distributed, scalable, cross-platform event processing on .NET. This package contains
14 | the logic necessary to dispatch Domain events stored in the browser's IndexedDb instance through registered
15 | IMessageHandlers.
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.AzureWebJobs/SimpleMessageBus.Samples.AzureWebJobs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net10.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | PreserveNewest
32 |
33 |
34 | appsettings.json
35 | PreserveNewest
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.IndexedDb/IndexedDbMessagePublisher.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using CloudNimble.SimpleMessageBus.IndexedDb.Core;
3 | using System.Threading.Tasks;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Publish.IndexedDb
6 | {
7 |
8 | ///
9 | /// Manages the process of publishing MessageBus messages to a browser-based IndexedDb database.
10 | ///
11 | ///
12 | /// This publisher enables client-side message queuing in Blazor WebAssembly applications
13 | /// using the browser's IndexedDB for persistent storage. It provides offline-capable
14 | /// messaging and local processing scenarios.
15 | ///
16 | public class IndexedDbMessagePublisher : IMessagePublisher
17 | {
18 |
19 | #region Private Members
20 |
21 | private readonly SimpleMessageBusDb _database;
22 |
23 | #endregion
24 |
25 | #region Constructors
26 |
27 | ///
28 | ///
29 | ///
30 | ///
31 | public IndexedDbMessagePublisher(SimpleMessageBusDb database)
32 | {
33 | _database = database;
34 | }
35 |
36 | #endregion
37 |
38 | #region Public Methods
39 |
40 | ///
41 | /// Publishes the specified to the specified incoming queue.
42 | ///
43 | /// The to wrap in a and publish to the queue.
44 | /// Specifies whether or not the event was generated by the system. (Not currently used).
45 | /// A reference for the asynchronous function.
46 | public async Task PublishAsync(IMessage message, bool isSystemGenerated = false)
47 | {
48 | var envelope = new MessageEnvelope(message);
49 | await _database.Queue.AddAsync(envelope);
50 | }
51 |
52 | #endregion
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.Azure/SimpleMessageBus.Tests.Dispatch.Azure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/Microsoft/AspNetCore/Components/WebAssembly/Hosting/WebAssemblyHostBuilder.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: WebAssemblyHostBuilder
3 | description: "Extension methods for WebAssemblyHostBuilder from Microsoft.AspNetCore.Components.WebAssembly"
4 | icon: file-brackets-curly
5 | keywords: ['WebAssemblyHostBuilder', 'Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder', 'Microsoft.AspNetCore.Components.WebAssembly.Hosting', 'error']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** Microsoft.AspNetCore.Components.WebAssembly.dll
11 |
12 | **Namespace:** Microsoft.AspNetCore.Components.WebAssembly.Hosting
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder
18 | ```
19 |
20 | ## Summary
21 |
22 | This type is defined in Microsoft.AspNetCore.Components.WebAssembly.
23 |
24 | ## Remarks
25 |
26 | See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.components.webassembly.hosting.webassemblyhostbuilder) for more information about the rest of the API.
27 |
28 | ## Methods
29 |
30 | ### UseIndexedDbMessagePublisher Extension
31 |
32 | Extension method from `Microsoft.AspNetCore.Components.WebAssembly.Hosting.SimpleMessageBus_Publish_IndexedDb_WebAssemblyHostBuilderExtensions`
33 |
34 | #### Syntax
35 |
36 | ```csharp
37 | public static void UseIndexedDbMessagePublisher(Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder builder, string configSectionName = "SimpleMessageBus:IndexedDb", System.Action indexedDbOptions = null)
38 | ```
39 |
40 | #### Parameters
41 |
42 | | Name | Type | Description |
43 | |------|------|-------------|
44 | | `builder` | `Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder` | - |
45 | | `configSectionName` | `string` | - |
46 | | `indexedDbOptions` | `System.Action` | - |
47 |
48 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/assembly-list.txt:
--------------------------------------------------------------------------------
1 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Amazon.Core\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Amazon.Core.dll
2 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Breakdance\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Breakdance.dll
3 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Core\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Core.dll
4 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.dll
5 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch.Amazon\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.Amazon.dll
6 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch.Azure\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.Azure.dll
7 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch.FileSystem\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.FileSystem.dll
8 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch.IndexedDb\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.IndexedDb.dll
9 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Dispatch.Kafka\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Dispatch.Kafka.dll
10 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Hosting\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Hosting.dll
11 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.IndexedDb.Core\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.IndexedDb.Core.dll
12 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Publish\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Publish.dll
13 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Publish.Amazon\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Publish.Amazon.dll
14 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Publish.Azure\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Publish.Azure.dll
15 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Publish.IndexedDb\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Publish.IndexedDb.dll
16 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Publish.Kafka\bin\Debug\net10.0\CloudNimble.SimpleMessageBus.Publish.Kafka.dll
17 | D:\GitHub\SimpleMessageBus\src\SimpleMessageBus.Tools\bin\Debug\net10.0\SimpleMessageBus.Tools.dll
18 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.IndexedDb.Core/SimpleMessageBusDb.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.BlazorEssentials.IndexedDb;
2 | using Microsoft.Extensions.Options;
3 | using Microsoft.JSInterop;
4 |
5 | namespace CloudNimble.SimpleMessageBus.IndexedDb.Core
6 | {
7 |
8 | ///
9 | /// Represents the IndexedDB database structure for SimpleMessageBus in Blazor WebAssembly applications.
10 | ///
11 | ///
12 | /// This class defines the IndexedDB schema used for client-side message queuing in Blazor WebAssembly.
13 | /// It provides three object stores for managing message lifecycle: Queue (pending), Completed (successful),
14 | /// and Failed (error) processing states.
15 | ///
16 | public class SimpleMessageBusDb : IndexedDbDatabase
17 | {
18 |
19 | private IndexedDbOptions IndexedDbOptions { get; set; }
20 |
21 | ///
22 | /// Gets or sets the object store for successfully processed messages.
23 | ///
24 | public IndexedDbObjectStore Completed { get; set; }
25 |
26 | ///
27 | /// Gets or sets the object store for messages that failed processing.
28 | ///
29 | public IndexedDbObjectStore Failed { get; set; }
30 |
31 | ///
32 | /// Gets or sets the object store for messages pending processing.
33 | ///
34 | public IndexedDbObjectStore Queue { get; set; }
35 |
36 | ///
37 | ///
38 | ///
39 | ///
40 | ///
41 | public SimpleMessageBusDb(IJSRuntime jsRuntime, IOptions indexedDbOptions) : base(jsRuntime)
42 | {
43 | IndexedDbOptions = indexedDbOptions.Value;
44 | Name = IndexedDbOptions.DatabaseName;
45 | Completed = new IndexedDbObjectStore(this, IndexedDbOptions.CompletedQueueName);
46 | Failed = new IndexedDbObjectStore(this, IndexedDbOptions.ErrorQueueName);
47 | Queue = new IndexedDbObjectStore(this, IndexedDbOptions.QueueName);
48 | }
49 |
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Amazon/QueueProcessors/AmazonSQSNameResolver.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Amazon.Core;
2 | using CloudNimble.WebJobs.Extensions.Amazon.SQS;
3 | using Microsoft.Azure.WebJobs;
4 | using Microsoft.Extensions.Options;
5 | using System;
6 |
7 | namespace CloudNimble.SimpleMessageBus.Dispatch
8 | {
9 |
10 | ///
11 | /// A for SimpleMessageBus instances backed by Amazon SQS.
12 | ///
13 | public class AmazonSQSNameResolver : INameResolver
14 | {
15 |
16 | #region Private Members
17 |
18 | private readonly AmazonSQSOptions _options;
19 | private readonly SQSNameResolver _baseResolver;
20 |
21 | #endregion
22 |
23 | #region Constructors
24 |
25 | ///
26 | /// Creates a new instance of the .
27 | ///
28 | /// The to use for configuration.
29 | /// The base SQS name resolver from WebJobs.Extensions.Amazon.
30 | public AmazonSQSNameResolver(IOptions options, SQSNameResolver baseResolver)
31 | {
32 | ArgumentNullException.ThrowIfNull(options);
33 | ArgumentNullException.ThrowIfNull(baseResolver);
34 | _options = options.Value;
35 | _baseResolver = baseResolver;
36 | }
37 |
38 | #endregion
39 |
40 | #region Public Methods
41 |
42 | ///
43 | /// Resolves the specified name.
44 | ///
45 | /// The name to resolve.
46 | /// The resolved value.
47 | public string Resolve(string name)
48 | {
49 | return name switch
50 | {
51 | "QueueName" => _options.QueueName,
52 | "CompletedQueueName" => _options.CompletedQueueName,
53 | "PoisonQueueName" => _options.PoisonQueueName,
54 | _ => _baseResolver.Resolve(name)
55 | };
56 | }
57 |
58 | #endregion
59 |
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.Kafka/SimpleMessageBus.Tests.Dispatch.Kafka.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch/SimpleMessageBus.Tests.Dispatch.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | PreserveNewest
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Azure/QueueProcessors/AzureStorageQueueNameResolver.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Azure.WebJobs;
3 | using Microsoft.Extensions.Options;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Dispatch
6 | {
7 |
8 | ///
9 | /// Helps dynamically resolve the name of the configured Queue at runtime.
10 | ///
11 | /// See https://github.com/Azure/azure-webjobs-sdk/wiki/Queues#set-values-for-webjobs-sdk-constructor-parameters-in-code.
12 | internal class AzureStorageQueueNameResolver : INameResolver
13 | {
14 |
15 | #region Private Members
16 |
17 | private AzureStorageQueueOptions _options;
18 |
19 | #endregion
20 |
21 | #region Constructors
22 |
23 | ///
24 | /// Creates a new instance of the
25 | ///
26 | /// The instance injected from the DI container.
27 | public AzureStorageQueueNameResolver(IOptions options)
28 | {
29 | _options = options.Value;
30 | }
31 |
32 | #endregion
33 |
34 | #region Public Methods
35 |
36 | ///
37 | /// Resolves queue names for Azure WebJobs triggers and outputs based on configuration.
38 | ///
39 | /// The placeholder name from the WebJobs attribute to resolve.
40 | /// The actual queue name from configuration.
41 | ///
42 | /// This method maps WebJobs attribute placeholders to actual configured queue names,
43 | /// enabling dynamic queue name resolution at runtime.
44 | ///
45 | public string Resolve(string name)
46 | {
47 | //RWM: This logic will have to be changed if we want to enable the ability to process more than one set of queues.
48 | return name == AzureStorageQueueConstants.CompletedQueueAttribute.Replace("%", "") ? _options.CompletedQueueName : _options.QueueName;
49 | }
50 |
51 | #endregion
52 |
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.IndexedDb.Core/IndexedDbOptions.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.IndexedDb.Core
2 | {
3 |
4 | ///
5 | /// Specifies the options required to leverage a browser's IndexedDB instance as the SimpleMessageBus backing queue.
6 | ///
7 | ///
8 | /// These options configure the IndexedDB database and object store names used for message queuing
9 | /// in Blazor WebAssembly applications. The default values follow SimpleMessageBus conventions
10 | /// and can be customized for specific application requirements.
11 | ///
12 | public class IndexedDbOptions
13 | {
14 |
15 | #region Properties
16 |
17 | ///
18 | /// The IndexedDb table where successfully-processed queue items will be moved to upon completion. Defaults to .
19 | ///
20 | public string CompletedQueueName { get; set; } = IndexedDbConstants.Completed;
21 |
22 | ///
23 | /// The name of the Database inside IndexedDb where the queue tables will be stored. Defaults to 'SimpleMessageBus'.
24 | ///
25 | public string DatabaseName { get; set; } = "SimpleMessageBus";
26 |
27 | ///
28 | /// The IndexedDb table where failed items will be stored while they are waiting to be analyzed and reprocessed. Defaults to .
29 | ///
30 | public string ErrorQueueName { get; set; } = IndexedDbConstants.Error;
31 |
32 | ///
33 | /// The IndexedDb table where items will be stored while they are waiting to be processed. Defaults to .
34 | ///
35 | public string QueueName { get; set; } = IndexedDbConstants.Queue;
36 |
37 | #endregion
38 |
39 | #region Constructors
40 |
41 | ///
42 | /// The default constructor, which sets the default values equal to the values specified in .
43 | ///
44 | public IndexedDbOptions()
45 | {
46 | }
47 |
48 | #endregion
49 |
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Overview
3 | description: "Summary of the CloudNimble.SimpleMessageBus.Dispatch.Triggers Namespace"
4 | icon: folder-tree
5 | mode: wide
6 | keywords: ['CloudNimble.SimpleMessageBus.Dispatch.Triggers', 'namespace', 'ISimpleMessageBusFileProcessorFactory', 'SimpleMessageBusFileProcessor', 'SimpleMessageBusFileProcessorFactoryContext', 'SimpleMessageBusFileAttribute', 'SimpleMessageBusFileTriggerAttribute']
7 | ---
8 |
9 | ## Types
10 |
11 | ### Classes
12 |
13 | | Name | Summary |
14 | | ---- | ------- |
15 | | [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor) | Default file processor used by [FileTriggerAttribute](https://learn.microsoft.com/dotnet/api/microsoft.azure.webjobs.filetriggerattribute). |
16 | | [SimpleMessageBusFileProcessorFactoryContext](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext) | Context input for [ISimpleMessageBusFileProcessorFactory](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/ISimpleMessageBusFileProcessorFactory) |
17 | | [SimpleMessageBusFileAttribute](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute) | Attribute used to bind a parameter to a file. |
18 | | [SimpleMessageBusFileTriggerAttribute](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute) | Attribute used to mark a job function that should be invoked based on file events. |
19 |
20 | ### Interfaces
21 |
22 | | Name | Summary |
23 | | ---- | ------- |
24 | | [ISimpleMessageBusFileProcessorFactory](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/ISimpleMessageBusFileProcessorFactory) | Factory interface for creating [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor) instances. This factory pattern allows different FileProcessors to be used for different job functions. |
25 |
26 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/ISimpleMessageBusFileProcessorFactory.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: ISimpleMessageBusFileProcessorFactory
3 | description: "Factory interface for creating [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor) i..."
4 | icon: plug
5 | sidebarTitle: ISimpleMessageBusFileProcessorFactory
6 | keywords: ['ISimpleMessageBusFileProcessorFactory', 'CloudNimble.SimpleMessageBus.Dispatch.Triggers.ISimpleMessageBusFileProcessorFactory', 'CloudNimble.SimpleMessageBus.Dispatch.Triggers', 'interface']
7 | ---
8 |
9 | ## Definition
10 |
11 | **Assembly:** CloudNimble.SimpleMessageBus.Dispatch.FileSystem.dll
12 |
13 | **Namespace:** CloudNimble.SimpleMessageBus.Dispatch.Triggers
14 |
15 | ## Syntax
16 |
17 | ```csharp
18 | CloudNimble.SimpleMessageBus.Dispatch.Triggers.ISimpleMessageBusFileProcessorFactory
19 | ```
20 |
21 | ## Summary
22 |
23 | Factory interface for creating [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor) instances. This factory pattern allows
24 | different FileProcessors to be used for different job functions.
25 |
26 | ## Methods
27 |
28 | ### CreateFileProcessor Abstract
29 |
30 | Create a [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor) for the specified inputs.
31 |
32 | #### Syntax
33 |
34 | ```csharp
35 | CloudNimble.SimpleMessageBus.Dispatch.Triggers.SimpleMessageBusFileProcessor CreateFileProcessor(CloudNimble.SimpleMessageBus.Dispatch.Triggers.SimpleMessageBusFileProcessorFactoryContext context)
36 | ```
37 |
38 | #### Parameters
39 |
40 | | Name | Type | Description |
41 | |------|------|-------------|
42 | | `context` | `CloudNimble.SimpleMessageBus.Dispatch.Triggers.SimpleMessageBusFileProcessorFactoryContext` | The context to use. |
43 |
44 | #### Returns
45 |
46 | Type: `CloudNimble.SimpleMessageBus.Dispatch.Triggers.SimpleMessageBusFileProcessor`
47 | The [SimpleMessageBusFileProcessor](/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessor)
48 |
49 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch/Extensions/IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using CloudNimble.SimpleMessageBus.Dispatch;
3 | using Microsoft.Extensions.DependencyInjection;
4 |
5 | namespace Microsoft.Extensions.Hosting
6 | {
7 |
8 | ///
9 | /// A set of extension methods that make it easy to register SimpleMessageBus with a DI container.
10 | ///
11 | public static class IHostBuilderExtensions
12 | {
13 |
14 | #region Public Methods
15 |
16 | ///
17 | /// Configures SimpleMessageBus to use the , which processes registered IMessageHandlers in series based on
18 | /// the order they were registered in the DI container.
19 | ///
20 | /// The instance to extend.
21 | /// The instance being configured, for fluent interaction.
22 | public static IHostBuilder UseOrderedMessageDispatcher(this IHostBuilder builder)
23 | {
24 | builder.ConfigureServices(services =>
25 | {
26 | services.AddSingleton();
27 | });
28 | return builder;
29 | }
30 |
31 | ///
32 | /// Configures SimpleMessageBus to use the , which processes registered IMessageHandlers in parallel
33 | /// regardless of the order the order they were registered in the DI container.
34 | ///
35 | /// The instance to extend.
36 | /// The instance being configured, for fluent interaction.
37 | public static IHostBuilder UseParallelMessageDispatcher(this IHostBuilder builder)
38 | {
39 | builder.ConfigureServices(services =>
40 | {
41 | services.AddSingleton();
42 | });
43 | return builder;
44 | }
45 |
46 | #endregion
47 |
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.SimpleClientApp/Program.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Publish;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 | using SimpleMessageBus.Samples.Core;
6 | using System;
7 | using System.Threading.Tasks;
8 |
9 | namespace SimpleMessageBus.Samples.SimpleClientApp
10 | {
11 | class Program
12 | {
13 |
14 | private static IHost _host;
15 |
16 | static async Task Main(string[] args)
17 | {
18 | var builder = Host.CreateDefaultBuilder();
19 | builder.ConfigureServices((hostContext, services) =>
20 | {
21 | Console.WriteLine($"SimpleMessageBus starting in the {hostContext.HostingEnvironment.EnvironmentName} Environment");
22 | Console.WriteLine($"Queue ConnectionString: {hostContext.Configuration["AzureStorageQueueOptions:StorageConnectionString"]}");
23 | Console.WriteLine($"WebJob ConnectionString: {hostContext.Configuration["ConnectionStrings:AzureWebJobsStorage"]}");
24 | });
25 | builder.UseFileSystemMessagePublisher(options =>
26 | {
27 | options.RootFolder = @"D:\Scratch\SimpleMessageBus\";
28 | })
29 | .ConfigureLogging((context, b) =>
30 | {
31 | b.SetMinimumLevel(LogLevel.Debug);
32 | b.AddConsole();
33 | })
34 | .UseConsoleLifetime();
35 |
36 | _host = builder.Build();
37 | #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
38 | _host.RunAsync();
39 | #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
40 |
41 | await CreateMessage(_host.Services.GetRequiredService());
42 | }
43 |
44 | public static async Task CreateMessage(IMessagePublisher publisher)
45 | {
46 | var message = new NewUserMessage()
47 | {
48 | Id = Guid.NewGuid(),
49 | Email = "robert@nimbleapps.cloud"
50 | };
51 | await publisher.PublishAsync(message);
52 | }
53 |
54 | }
55 |
56 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.FileSystem/SimpleMessageBus.Tests.Dispatch.FileSystem.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net10.0;net9.0;net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | PreserveNewest
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.OnPrem/SimpleMessageBus.Samples.OnPrem.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net10.0;net9.0;net8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | PreserveNewest
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Docs/api-reference/CloudNimble/SimpleMessageBus/Publish/IMessagePublisher.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: IMessagePublisher
3 | description: "Defines the functionality required for publishing an [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) to a supported backing queue."
4 | icon: plug
5 | keywords: ['IMessagePublisher', 'CloudNimble.SimpleMessageBus.Publish.IMessagePublisher', 'CloudNimble.SimpleMessageBus.Publish', 'interface']
6 | ---
7 |
8 | ## Definition
9 |
10 | **Assembly:** CloudNimble.SimpleMessageBus.Publish.dll
11 |
12 | **Namespace:** CloudNimble.SimpleMessageBus.Publish
13 |
14 | ## Syntax
15 |
16 | ```csharp
17 | CloudNimble.SimpleMessageBus.Publish.IMessagePublisher
18 | ```
19 |
20 | ## Summary
21 |
22 | Defines the functionality required for publishing an [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) to a supported backing queue.
23 |
24 | ## Remarks
25 |
26 | Message publishers are the entry point for sending messages into the SimpleMessageBus system.
27 | Different implementations support various queue providers (Azure, Amazon, FileSystem, IndexedDB)
28 | while maintaining a consistent interface for application code.
29 |
30 | ## Methods
31 |
32 | ### PublishAsync Abstract
33 |
34 | Publishes the specified [IMessage](/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage) to a queue.
35 |
36 | #### Syntax
37 |
38 | ```csharp
39 | System.Threading.Tasks.Task PublishAsync(CloudNimble.SimpleMessageBus.Core.IMessage message, bool isSystemGenerated = false)
40 | ```
41 |
42 | #### Parameters
43 |
44 | | Name | Type | Description |
45 | |------|------|-------------|
46 | | `message` | `CloudNimble.SimpleMessageBus.Core.IMessage` | The message to add to the queue. |
47 | | `isSystemGenerated` | `bool` | Specifies whether the message comes from the currently-authenticated user, or is a system-generated message.
48 | This flag can be used for auditing, routing, or processing decisions. |
49 |
50 | #### Returns
51 |
52 | Type: `System.Threading.Tasks.Task`
53 | A task representing the asynchronous publish operation.
54 |
55 | #### Exceptions
56 |
57 | | Exception | Description |
58 | |-----------|-------------|
59 | | `ArgumentNullException` | Thrown when *message* is null. |
60 |
61 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.ExternalTriggers/SampleTimers.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Publish;
2 | using Microsoft.Azure.WebJobs;
3 | using Microsoft.Extensions.Logging;
4 | using SimpleMessageBus.Samples.Core;
5 | using System;
6 | using System.Threading.Tasks;
7 |
8 | namespace SimpleMessageBus.Samples.ExternalTriggers
9 | {
10 |
11 | ///
12 | /// This class demonstrates how to have TimerTrigger methods live in separate assemblies.
13 | ///
14 | public class SampleTimers
15 | {
16 |
17 | IMessagePublisher _publisher;
18 |
19 | ///
20 | ///
21 | ///
22 | ///
23 | public SampleTimers(IMessagePublisher publisher)
24 | {
25 | _publisher = publisher;
26 | }
27 |
28 | ///
29 | /// A sample function to show how to trigger jobs that run at specific times or specific frequencies.
30 | ///
31 | /// The passed in object with details about the Timer event that triggered the function call.
32 | /// The instance to write log entries to.
33 | ///
34 | /// The is required, along with a function to register dependencies in the DI container (even if that function does nothing),
35 | /// in order for Functions in separate assemblies to be located and called properly. The name you specify can be anything you like, and does not have to match the
36 | /// actual name of the method.
37 | ///
38 | [FunctionName(nameof(Run))]
39 | public async Task Run([TimerTrigger("00:00:10", UseMonitor = true)]TimerInfo myTimer, ILogger log)
40 | {
41 | if (myTimer.IsPastDue)
42 | {
43 | log.LogInformation("Timer is running late!");
44 | }
45 | log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
46 |
47 | var message = new NewUserMessage()
48 | {
49 | Id = Guid.NewGuid(),
50 | Email = "timertest@simplemessagebus"
51 | };
52 | await _publisher.PublishAsync(message);
53 | }
54 |
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish/Extensions/IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using CloudNimble.SimpleMessageBus.Publish;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using System;
5 |
6 | namespace Microsoft.Extensions.Hosting
7 | {
8 |
9 | ///
10 | ///
11 | ///
12 | public static class SimpleMessageBus_Publish_IHostBuilderExtensions
13 | {
14 |
15 | ///
16 | ///
17 | ///
18 | /// The instance to extend.
19 | /// The instance being configured, for fluent interaction.
20 | public static IHostBuilder UseFileSystemMessagePublisher(this IHostBuilder builder)
21 | {
22 | if (builder is null)
23 | {
24 | throw new ArgumentNullException(nameof(builder));
25 | }
26 |
27 | return builder
28 | .ConfigureServices((hostContext, services) =>
29 | {
30 | services.Configure(hostContext.Configuration.GetSection(typeof(FileSystemOptions).Name));
31 | })
32 | .UseFileSystemMessagePublisher(o => { });
33 | }
34 |
35 | ///
36 | ///
37 | ///
38 | /// The instance to extend.
39 | ///
40 | /// The instance being configured, for fluent interaction.
41 | public static IHostBuilder UseFileSystemMessagePublisher(this IHostBuilder builder, Action fileSystemOptions)
42 | {
43 | if (builder is null)
44 | {
45 | throw new ArgumentNullException(nameof(builder));
46 | }
47 |
48 | if (fileSystemOptions is null)
49 | {
50 | throw new ArgumentNullException(nameof(fileSystemOptions));
51 | }
52 |
53 | builder.ConfigureServices((hostContext, services) =>
54 | {
55 | services.Configure(fileSystemOptions);
56 | services.AddSingleton();
57 | });
58 |
59 | return builder;
60 | }
61 |
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Core/Kafka/KafkaOptions.cs:
--------------------------------------------------------------------------------
1 | namespace CloudNimble.SimpleMessageBus.Core
2 | {
3 |
4 | ///
5 | /// Specifies the options required to leverage Apache Kafka as the SimpleMessageBus backing queue.
6 | ///
7 | public class KafkaOptions
8 | {
9 |
10 | #region Properties
11 |
12 | ///
13 | /// The SASL authentication mechanism when using SASL protocols.
14 | ///
15 | public KafkaAuthenticationMode AuthenticationMode { get; set; } = KafkaAuthenticationMode.NotSet;
16 |
17 | ///
18 | /// The Kafka broker list (e.g., "localhost:9092" or "broker1:9092,broker2:9092").
19 | ///
20 | public string BrokerList { get; set; }
21 |
22 | ///
23 | /// The consumer group ID for message consumption.
24 | ///
25 | public string ConsumerGroup { get; set; }
26 |
27 | ///
28 | /// Maximum number of messages to process in a batch. Default is 64.
29 | ///
30 | public int MaxBatchSize { get; set; } = 64;
31 |
32 | ///
33 | /// SASL password for authentication.
34 | ///
35 | public string Password { get; set; }
36 |
37 | ///
38 | /// The security protocol for broker communication.
39 | ///
40 | public KafkaBrokerProtocol Protocol { get; set; } = KafkaBrokerProtocol.Plaintext;
41 |
42 | ///
43 | /// Path to CA certificate file for SSL/TLS verification.
44 | ///
45 | public string SslCaLocation { get; set; }
46 |
47 | ///
48 | /// The name of the Kafka topic for messages.
49 | ///
50 | public string TopicName { get; set; }
51 |
52 | ///
53 | /// SASL username for authentication.
54 | ///
55 | public string Username { get; set; }
56 |
57 | #endregion
58 |
59 | #region Constructors
60 |
61 | ///
62 | /// Creates a new instance with default values from .
63 | ///
64 | public KafkaOptions()
65 | {
66 | TopicName = KafkaConstants.Topic;
67 | ConsumerGroup = KafkaConstants.DefaultConsumerGroup;
68 | }
69 |
70 | #endregion
71 |
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.Azure/Extensions/IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using CloudNimble.SimpleMessageBus.Publish;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using System;
5 |
6 | namespace Microsoft.Extensions.Hosting
7 | {
8 |
9 | ///
10 | ///
11 | ///
12 | public static class SimpleMessageBus_Publish_IHostBuilderExtensions
13 | {
14 |
15 | ///
16 | ///
17 | ///
18 | /// The instance to extend.
19 | /// The instance being configured, for fluent interaction.
20 | public static IHostBuilder UseAzureStorageQueueMessagePublisher(this IHostBuilder builder)
21 | {
22 | if (builder is null)
23 | {
24 | throw new ArgumentNullException(nameof(builder));
25 | }
26 |
27 | return builder
28 | .ConfigureServices((hostContext, services) =>
29 | {
30 | services.Configure(hostContext.Configuration.GetSection(typeof(AzureStorageQueueOptions).Name));
31 | })
32 | .UseAzureStorageQueueMessagePublisher(o => { });
33 | }
34 |
35 | ///
36 | ///
37 | ///
38 | /// The instance to extend.
39 | ///
40 | /// The instance being configured, for fluent interaction.
41 | public static IHostBuilder UseAzureStorageQueueMessagePublisher(this IHostBuilder builder, Action azureQueueOptions)
42 | {
43 | if (builder is null)
44 | {
45 | throw new ArgumentNullException(nameof(builder));
46 | }
47 |
48 | if (azureQueueOptions is null)
49 | {
50 | throw new ArgumentNullException(nameof(azureQueueOptions));
51 | }
52 |
53 | builder.ConfigureServices((hostContext, services) =>
54 | {
55 | services.Configure(azureQueueOptions);
56 | services.AddSingleton();
57 | });
58 |
59 | return builder;
60 | }
61 |
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Config/Files_IWebJobsBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | using System;
5 | using Microsoft.Azure.WebJobs;
6 | using Microsoft.Azure.WebJobs.Extensions.Files;
7 | using Microsoft.Extensions.DependencyInjection;
8 |
9 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
10 | {
11 | ///
12 | /// Extension methods for Files integration
13 | ///
14 | public static class Files_IWebJobsBuilderExtensions
15 | {
16 | ///
17 | /// Adds the Files extension to the provided .
18 | ///
19 | /// The to configure.
20 | public static IWebJobsBuilder AddSimpleMessageBusFiles(this IWebJobsBuilder builder)
21 | {
22 | if (builder is null)
23 | {
24 | throw new ArgumentNullException(nameof(builder));
25 | }
26 |
27 | builder.AddExtension()
28 | .BindOptions();
29 | builder.Services.AddSingleton();
30 | builder.Services.AddSingleton();
31 |
32 | return builder;
33 | }
34 |
35 | ///
36 | /// Adds the Files extension to the provided .
37 | ///
38 | /// The to configure.
39 | /// An to configure the provided .
40 | public static IWebJobsBuilder AddSimpleMessageBusFiles(this IWebJobsBuilder builder, Action configure)
41 | {
42 | if (builder is null)
43 | {
44 | throw new ArgumentNullException(nameof(builder));
45 | }
46 |
47 | if (configure is null)
48 | {
49 | throw new ArgumentNullException(nameof(configure));
50 | }
51 |
52 | builder.AddSimpleMessageBusFiles();
53 | builder.Services.Configure(configure);
54 |
55 | return builder;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Publish.IndexedDb/Extensions/IHostBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.BlazorEssentials.IndexedDb;
2 | using CloudNimble.SimpleMessageBus.IndexedDb.Core;
3 | using CloudNimble.SimpleMessageBus.Publish;
4 | using CloudNimble.SimpleMessageBus.Publish.IndexedDb;
5 | using Microsoft.Extensions.Configuration;
6 | using Microsoft.Extensions.DependencyInjection;
7 | using System;
8 |
9 | namespace Microsoft.Extensions.Hosting
10 | {
11 |
12 | ///
13 | ///
14 | ///
15 | public static class SimpleMessageBus_Publish_IndexedDb_IHostBuilderExtensions
16 | {
17 |
18 | ///
19 | ///
20 | ///
21 | /// The instance to extend.
22 | ///
23 | /// The name of the to load the from. Defaults to 'SimpleMessageBus:IndexedDb'.
24 | ///
25 | ///
26 | /// An lambda that allows you to set the inline.
27 | ///
28 | /// The instance being configured, for fluent configuration.
29 | ///
30 | public static IHostBuilder UseIndexedDbMessagePublisher(this IHostBuilder builder, string configSectionName = "SimpleMessageBus:IndexedDb",
31 | Action indexedDbOptions = null)
32 | {
33 | ArgumentNullException.ThrowIfNull(builder);
34 |
35 | builder.ConfigureServices((hostContext, services) =>
36 | {
37 | var config = hostContext.Configuration.GetSection(configSectionName);
38 | if (config is null && indexedDbOptions is null)
39 | {
40 | services.AddOptions();
41 | }
42 |
43 | if (config is not null)
44 | {
45 | services.Configure(config);
46 | }
47 |
48 | if (indexedDbOptions is not null)
49 | {
50 | services.Configure(indexedDbOptions);
51 | }
52 |
53 | services.AddScoped();
54 | services.AddScoped();
55 | });
56 |
57 | return builder;
58 | }
59 |
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.OnPrem/Program.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Microsoft.Extensions.Hosting;
5 | using Microsoft.Extensions.Logging;
6 | using System;
7 | using System.IO;
8 |
9 | namespace SimpleMessageBus.Samples.OnPrem
10 | {
11 |
12 | ///
13 | ///
14 | ///
15 | public class Program
16 | {
17 |
18 | ///
19 | ///
20 | ///
21 | ///
22 | static void Main(string[] args)
23 | {
24 |
25 | #if netcore3_0
26 | var builder = Host.CreateDefaultBuilder()
27 | #else
28 | var builder = new HostBuilder()
29 | .UseEnvironment("Development")
30 | .UseContentRoot(Directory.GetCurrentDirectory())
31 | .ConfigureAppConfiguration((hostingContext, config) =>
32 | {
33 | var env = hostingContext.HostingEnvironment;
34 |
35 | config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
36 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
37 |
38 | config.AddEnvironmentVariables();
39 | })
40 | #endif
41 | // RWM: Configure the services before you call Use____QueueProcessor so that the assembly is loaded into memory before the Reflection happens.
42 | .ConfigureServices((hostContext, services) =>
43 | {
44 | Console.WriteLine($"SimpleMessageBus starting in the {hostContext.HostingEnvironment.EnvironmentName} Environment");
45 | services.AddTimerDependencies();
46 | services.AddSingleton();
47 | })
48 | .UseFileSystemMessagePublisher()
49 | .UseFileSystemQueueProcessor()
50 | .UseOrderedMessageDispatcher()
51 | .ConfigureLogging((context, b) =>
52 | {
53 | b.SetMinimumLevel(LogLevel.Debug);
54 | b.AddConsole();
55 | });
56 |
57 | #if netcore3_0
58 | builder.UseSimpleMessageBusLifetime();
59 | #else
60 | builder.UseConsoleLifetime();
61 | #endif
62 |
63 | var host = builder.Build();
64 | using (host)
65 | host.Run();
66 | }
67 |
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Tests.Dispatch.FileSystem/FileSystemNameResolverTests.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.Breakdance.Extensions.MSTest2;
2 | using CloudNimble.SimpleMessageBus.Core;
3 | using CloudNimble.SimpleMessageBus.Dispatch;
4 | using FluentAssertions;
5 | using Microsoft.Azure.WebJobs;
6 | using Microsoft.Extensions.DependencyInjection;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.VisualStudio.TestTools.UnitTesting;
9 | using System.IO;
10 |
11 | namespace SimpleMessageBus.Tests
12 | {
13 |
14 | [TestClass]
15 | public class FileSystemNameResolverTests : BreakdanceMSTestBase
16 | {
17 |
18 | private string rootPath = Path.Combine(Path.GetTempPath(), "smb-tests");
19 |
20 | #region Test Lifecycle
21 |
22 | ///
23 | /// Sets up services needed for tests.
24 | ///
25 | [TestInitialize]
26 | public void TestInitialize()
27 | {
28 | TestHostBuilder.UseFileSystemQueueProcessor(options => options.RootFolder = rootPath);
29 | TestSetup();
30 | }
31 |
32 | #endregion
33 |
34 | [TestMethod]
35 | public void Resolver_Should_ResolveQueueFolder()
36 | {
37 | var resolver = TestHost.Services.GetRequiredService();
38 | resolver.GetType().Should().Be();
39 |
40 | resolver.Resolve("queue").Should().Be(Path.Combine(rootPath, FileSystemConstants.Queue));
41 | }
42 |
43 | [TestMethod]
44 | public void Resolver_Should_ResolveCompletedFolder()
45 | {
46 | var resolver = TestHost.Services.GetRequiredService();
47 | resolver.GetType().Should().Be();
48 |
49 | resolver.Resolve("completed").Should().Be(Path.Combine(rootPath, FileSystemConstants.Completed));
50 | }
51 |
52 | [TestMethod]
53 | public void Resolver_Should_ResolveErrorFolder()
54 | {
55 | var resolver = TestHost.Services.GetRequiredService();
56 | resolver.GetType().Should().Be();
57 |
58 | resolver.Resolve("error").Should().Be(Path.Combine(rootPath, FileSystemConstants.Error));
59 | }
60 |
61 | [TestMethod]
62 | public void Resolver_Should_ResolveRandomFolder()
63 | {
64 | var resolver = TestHost.Services.GetRequiredService();
65 | resolver.GetType().Should().Be();
66 |
67 | resolver.Resolve("psychopath").Should().Be(Path.Combine(rootPath, FileSystemConstants.Queue));
68 | }
69 |
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Templates.Package/CloudNimble.SimpleMessageBus.Templates.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.0.0
5 | MinimumVisualStudioVersion = 16.0.0.0
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{79F3D1CC-DCDB-4FED-B302-95C0E66E31B2}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Back-End", "Back-End", "{2C1BE235-C831-4D57-972A-2BF444219251}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimpleMessageBus", "SimpleMessageBus", "{D06CA327-075E-4BD3-9C10-DB4C90F1D17C}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleMessageBus.Templates.Core", "SimpleMessageBus.Templates.Core\SimpleMessageBus.Templates.Core.csproj", "{42877D64-64FA-4587-821C-8DF3684D253D}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleMessageBus.Templates.Dispatch", "SimpleMessageBus.Templates.Dispatch\SimpleMessageBus.Templates.Dispatch.csproj", "{9ED207D3-9B63-44AC-88D8-8A49A598C6B4}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {42877D64-64FA-4587-821C-8DF3684D253D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {42877D64-64FA-4587-821C-8DF3684D253D}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {42877D64-64FA-4587-821C-8DF3684D253D}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {42877D64-64FA-4587-821C-8DF3684D253D}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {9ED207D3-9B63-44AC-88D8-8A49A598C6B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {9ED207D3-9B63-44AC-88D8-8A49A598C6B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {9ED207D3-9B63-44AC-88D8-8A49A598C6B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {9ED207D3-9B63-44AC-88D8-8A49A598C6B4}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(NestedProjects) = preSolution
35 | {79F3D1CC-DCDB-4FED-B302-95C0E66E31B2} = {2C1BE235-C831-4D57-972A-2BF444219251}
36 | {D06CA327-075E-4BD3-9C10-DB4C90F1D17C} = {2C1BE235-C831-4D57-972A-2BF444219251}
37 | {42877D64-64FA-4587-821C-8DF3684D253D} = {D06CA327-075E-4BD3-9C10-DB4C90F1D17C}
38 | {9ED207D3-9B63-44AC-88D8-8A49A598C6B4} = {D06CA327-075E-4BD3-9C10-DB4C90F1D17C}
39 | EndGlobalSection
40 | GlobalSection(ExtensibilityGlobals) = postSolution
41 | SolutionGuid = {E61AAC49-4387-40BC-BCC3-8A79D965D62D}
42 | EndGlobalSection
43 | EndGlobal
44 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Samples.OnPrem/EmailMessageHandler.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using SimpleMessageBus.Samples.Core;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 |
7 | namespace SimpleMessageBus.Samples.OnPrem
8 | {
9 |
10 | ///
11 | /// An example handler that shows how to process IMessages coming off the queue that require email notifications.
12 | ///
13 | public class EmailMessageHandler : IMessageHandler
14 | {
15 |
16 | ///
17 | /// Specifies which types are handled by this .
18 | ///
19 | /// An containing all of the types this supports.
20 | public IEnumerable GetHandledMessageTypes()
21 | {
22 | yield return typeof(NewUserMessage);
23 | }
24 |
25 | ///
26 | ///
27 | ///
28 | ///
29 | ///
30 | ///
31 | public Task OnErrorAsync(IMessage message, Exception exception) => throw new NotImplementedException();
32 |
33 | ///
34 | ///
35 | ///
36 | ///
37 | ///
38 | public async Task OnNextAsync(MessageEnvelope messageEnvelope)
39 | {
40 | var result = false;
41 | var messageType = Type.GetType(messageEnvelope.MessageType);
42 |
43 | switch (messageType)
44 | {
45 | case Type newUserMessage when newUserMessage == typeof(NewUserMessage):
46 | result = await SendNewUserEmailAsync(messageEnvelope.GetMessage());
47 | break;
48 | }
49 |
50 | //RWM: Throw an exception to get the message tossed in the poison queue.
51 | if (!result)
52 | {
53 | throw new Exception("Message processing failed.");
54 | }
55 | }
56 |
57 | ///
58 | ///
59 | ///
60 | ///
61 | ///
62 | internal async Task SendNewUserEmailAsync(NewUserMessage newUserMessage)
63 | {
64 | //TODO: Send email here.
65 | Console.WriteLine("The message has been processed.");
66 | return await Task.FromResult(true);
67 | }
68 |
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/.github/copilot-instructions.md:
--------------------------------------------------------------------------------
1 | ## General
2 |
3 | * Make only high confidence suggestions when reviewing code changes.
4 | * Always use the latest version C#. When global.json targets .NET 8, use C# 12. When it targets .NET 9.0, use C# 13. When it uses .NET 10.0, target C# 14.
5 | * Never change global.json unless explicitly asked to.
6 | * Always prefer `.IsNullOrWhiteSpace()` over `.IsNullOrEmpty()` for strings.
7 | * Always prefer `ArgumentException.ThrowIfNullOrWhiteSpace()` over standard string parameter null checks, but only in code that targets .NET 8 or later.
8 | * Always prefer `ArgumentNullException.ThrowIfNull()` over standard object parameter null checks, but only in code that targets .NET 8 or later.
9 | * Always use defense-in-depth and fail-first programming to only execute a task after all the ways it could fail have been checked.
10 | * Don't generate interfaces for dependency injection unless ABSOLUTELY necessary.
11 |
12 | ## Formatting
13 |
14 | * Apply code-formatting style defined in `.editorconfig`.
15 | * Prefer normal namespace declarations (NOT file-scoped) and single-line using directives.
16 | * Insert a newline before the opening curly brace of any code block (e.g., after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.).
17 | * Ensure that the final return statement of a method is on its own line.
18 | * Organize code into groups surrounded by #regions in the following order: Fields, Properties, Constructors, Public Methods, Private Methods.
19 | - Region instructions should be surrounded by blank lines.
20 | * Members should be ordered by visibility, with public members first, followed by protected, internal, and private members.
21 | * Fields, properties, and methods should be ordered alphabetically within their visibility group.
22 | * Use pattern matching, switch expressions, range expressions, and collection initializers wherever possible.
23 | * Use `nameof` instead of string literals when referring to member names.
24 | * Ensure that extensive XML doc comments are created for any APIs. When applicable, include and documentation in the comments. Only tags should be on the same line as content.
25 |
26 | ### Nullable Reference Types
27 |
28 | * Declare variables non-nullable, and check for `null` at entry points.
29 | * Always use `is null` or `is not null` instead of `== null` or `!= null`.
30 | * Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.
31 |
32 | ### Testing
33 |
34 | * We use MSTest v3, Breakdance, and FluentAssertions for tests.
35 | * Do not emit "Act", "Arrange" or "Assert" comments.
36 | * Do not use any mocking in tests.
37 | * Copy existing style in nearby files for test method names and capitalization.
38 | * Always prefer `.NotBeNullOrWhiteSpace()` over `.NotBeNullOrEmpty()` for testing strings.
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.FileSystem/Triggers/Listener/SimpleMessageBusFileProcessorFactoryContext.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the MIT License. See License.txt in the project root for license information.
3 |
4 | using System;
5 | using CloudNimble.SimpleMessageBus.Core;
6 | using Microsoft.Azure.WebJobs.Extensions.Files;
7 | using Microsoft.Azure.WebJobs.Host.Executors;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace CloudNimble.SimpleMessageBus.Dispatch.Triggers
11 | {
12 |
13 | ///
14 | /// Context input for
15 | ///
16 | public class SimpleMessageBusFileProcessorFactoryContext
17 | {
18 |
19 | ///
20 | /// Gets the
21 | ///
22 | public FileSystemOptions Options { get; private set; }
23 |
24 | ///
25 | /// Gets the
26 | ///
27 | public SimpleMessageBusFileTriggerAttribute Attribute { get; private set; }
28 |
29 | ///
30 | /// Gets the function executor
31 | ///
32 | public ITriggeredFunctionExecutor Executor { get; private set; }
33 |
34 | ///
35 | /// Gets the .
36 | ///
37 | public ILogger Logger { get; private set; }
38 |
39 | ///
40 | /// Gets the queue folder.
41 | ///
42 | public string QueueFolder { get; private set; }
43 |
44 | ///
45 | /// Constructs a new instance
46 | ///
47 | /// The
48 | /// The
49 | ///
50 | /// The function executor.
51 | /// The .
52 | public SimpleMessageBusFileProcessorFactoryContext(FileSystemOptions options, SimpleMessageBusFileTriggerAttribute attribute, string queueFolder, ITriggeredFunctionExecutor executor, ILogger logger)
53 | {
54 | Options = options ?? throw new ArgumentNullException(nameof(options));
55 | Attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
56 | QueueFolder = queueFolder ?? throw new ArgumentNullException(nameof(queueFolder));
57 | Executor = executor ?? throw new ArgumentNullException(nameof(executor));
58 | Logger = logger ?? throw new ArgumentNullException(nameof(logger));
59 | }
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/SimpleMessageBus.Dispatch.Kafka/QueueProcessors/KafkaNameResolver.cs:
--------------------------------------------------------------------------------
1 | using CloudNimble.SimpleMessageBus.Core;
2 | using Microsoft.Azure.WebJobs;
3 | using Microsoft.Extensions.Options;
4 |
5 | namespace CloudNimble.SimpleMessageBus.Dispatch.Kafka
6 | {
7 |
8 | ///
9 | /// Resolves Kafka configuration placeholders at runtime for WebJobs triggers.
10 | ///
11 | ///
12 | ///
13 | /// This resolver maps placeholders in WebJobs attributes (like "%topic%") to actual
14 | /// configuration values from .
15 | ///
16 | ///
17 | /// See https://github.com/Azure/azure-webjobs-sdk/wiki/Queues#set-values-for-webjobs-sdk-constructor-parameters-in-code
18 | /// for more information about name resolution in WebJobs.
19 | ///
20 | ///
21 | internal class KafkaNameResolver : INameResolver
22 | {
23 |
24 | #region Private Members
25 |
26 | private readonly KafkaOptions _options;
27 |
28 | #endregion
29 |
30 | #region Constructors
31 |
32 | ///
33 | /// Creates a new instance of .
34 | ///
35 | /// The instance injected from the DI container.
36 | public KafkaNameResolver(IOptions options)
37 | {
38 | _options = options.Value;
39 | }
40 |
41 | #endregion
42 |
43 | #region Public Methods
44 |
45 | ///
46 | /// Resolves a placeholder name to its configured value.
47 | ///
48 | /// The placeholder name (without % delimiters).
49 | /// The resolved configuration value, or null if the placeholder is not recognized.
50 | ///
51 | /// Supported placeholders:
52 | ///
53 | /// - topic - resolves to
54 | /// - consumergroup - resolves to
55 | /// - brokerlist - resolves to
56 | ///
57 | ///
58 | public string Resolve(string name)
59 | {
60 | return name switch
61 | {
62 | "topic" => _options.TopicName,
63 | "consumergroup" => _options.ConsumerGroup,
64 | "brokerlist" => _options.BrokerList,
65 | _ => null
66 | };
67 | }
68 |
69 | #endregion
70 |
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------