ServerTools.ServerCommands.AzureServiceBus
1.0.3.3
See the version list below for details.
dotnet add package ServerTools.ServerCommands.AzureServiceBus --version 1.0.3.3
NuGet\Install-Package ServerTools.ServerCommands.AzureServiceBus -Version 1.0.3.3
<PackageReference Include="ServerTools.ServerCommands.AzureServiceBus" Version="1.0.3.3" />
<PackageVersion Include="ServerTools.ServerCommands.AzureServiceBus" Version="1.0.3.3" />
<PackageReference Include="ServerTools.ServerCommands.AzureServiceBus" />
paket add ServerTools.ServerCommands.AzureServiceBus --version 1.0.3.3
#r "nuget: ServerTools.ServerCommands.AzureServiceBus, 1.0.3.3"
#:package ServerTools.ServerCommands.AzureServiceBus@1.0.3.3
#addin nuget:?package=ServerTools.ServerCommands.AzureServiceBus&version=1.0.3.3
#tool nuget:?package=ServerTools.ServerCommands.AzureServiceBus&version=1.0.3.3
About
ServerCommands facilitates running of units of code or commands remotely. It incorporates principles of messaging architectures used by most messaging tools and frameworks, like Azure Service Bus, AWS SQS, RabbitMQ, or Azure Storage Queues, Apache Kafka without any of the knowledge and configuration expertise to manage such installations and configurations.
This library is a spcific implementation that uses Azure Service Bus. Other implementations are listed below. If you want to create your own extension skip to the section on How to create your own extension to this library.
Implementations
- Azure Storage Queues
- Azure Service Bus
- AWS SQS (coming soon)
- RabbitMQ (coming soon)
- Apache Kafka (coming soon)
More documentation is available at the ServerCommands.
How to Use
To post a command:
var c = await new CloudCommands().InitializeAsync(new CommandContainer(), new AzureServiceBusConnectionOptions(Environment.GetEnvironmentVariable["ASBConnectionString"], MaxDequeueCountForError: 3, Log: new DebugLoggerProvider().CreateLogger("default"), QueueNamePrefix: "intro"));
_ = await c.PostCommandAsync<AddNumbersCommand>(new { Number1 = 2, Number2 = 3 });
//or _ = await c.PostCommandAsync(typeof(AddNumbersCommand), new { Number1 = 2, Number2 = 3 });
To execute commands:
var _container = new CommandContainer();
_container
.Use(logger)
.RegisterCommand<AddNumbersCommand>()
.RegisterResponse<AddNumbersCommand, AddNumbersResponse>();
var c = await new CloudCommands().InitializeAsync(_container, new AzureServiceBusConnectionOptions(Environment.GetEnvironmentVariable["ASBConnectionString"], MaxDequeueCountForError: 3, Log: new DebugLoggerProvider().CreateLogger("default"), QueueNamePrefix: "intro"));
var result = await c.ExecuteCommandsAsync()();
//check if something was wrong or if any items were processed at all
Assert.IsTrue(!result.Item1);
//check if 1 or more items were processed
Assert.IsTrue(result.Item2 > 0);
//check if there was any errors
Assert.IsTrue(result.Item3.Count > 0); //This value keeps the list of error messages that were encountered. After retrying 5 times the command is moved to the deadletterqueue.
If a command generates a response, than you also execute and responses:
var responses = commands.ExecuteResponsesAsync();
Assert.IsTrue(!responses.Item1);
Assert.IsTrue(responses.Item2 > 0);
And that's that!
For more detailed documentation and more complex use cases head to the offical documentation at the GitHub repo. If there are questions or request new feautures do not hesitate to post them there.
Key Features
- Cross-usability between services
- Cross-functionality between clouds or on-prem
- Enhanced simplicity
- Asynchroneous remote execution
- Batching and correlation of commands
- Commands with remote response execution
- High performance
- Supports .NET 5.0+
Related Packages
- Azure.Storage.Queues: GitHub | Nuget
- Microsoft.Extensions.Logging: Nuget
- DryIoc: GitHub | Nuget
- Polly: GitHub | Nuget
Feedback
ServerCommands is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Azure.Messaging.ServiceBus (>= 7.8.1)
- ServerTools.ServerCommands (>= 1.0.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Some release notes