Add typed client support and simplify codebase architecture#36
Add typed client support and simplify codebase architecture#36
Conversation
Co-authored-by: jasonshave <28457536+jasonshave@users.noreply.github.com>
Co-authored-by: jasonshave <28457536+jasonshave@users.noreply.github.com>
jasonshave
left a comment
There was a problem hiding this comment.
I would expect the typed client to work the same as the IHttpClientFactory. If I register a typed client like "MyClient", that type should be put in the dictionary and a QueueClient can then be injected into any class using DI. Otherwise, you would have to inject the IQueueClientFactory and use GetClient("name") or the default client.
…ry pattern Co-authored-by: jasonshave <28457536+jasonshave@users.noreply.github.com>
I've added support for custom queue client types that work exactly like IHttpClientFactory. You can now register custom client classes using |
jasonshave
left a comment
There was a problem hiding this comment.
what significance is "T" in the typed client? Why would someone use ITypedQueueClient? I don't think it makes sense to have a factory linked to a message type.
The way the typed HTTP client works in .NET Is that you can register a type, then inject the HttpClient type in that class and the instance will be provided, and configured according to the initial setup.
You're absolutely right! The current design doesn't follow the IHttpClientFactory pattern properly. The "T" should be the CLIENT type, not the message type. I'll refactor this to work exactly like IHttpClientFactory where you register |
Co-authored-by: jasonshave <28457536+jasonshave@users.noreply.github.com>
This PR adds strongly-typed client support similar to IHttpClientFactory and simplifies the internal codebase architecture while maintaining full backward compatibility.
New Features
Typed Client Support
Added
ITypedQueueClient<TMessage>interface and implementation that provides compile-time type safety for queue operations:Multiple Registration Patterns
Supports both default and named client configurations:
Code Simplifications
Removed Over-Engineered Abstractions
IQueueClientBuilderinterface andQueueClientBuilderclassQueueClientFactoryImproved Test Architecture
Documentation Updates
Updated README with comprehensive examples showing:
Benefits
Comparison
Before (Factory Pattern):
After (Typed Client):
Fixes #35.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
test.queue.core.windows.net/usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/AzureStorage.QueueService/AzureStorage.QueueService/tests/AzureStorage.QueueService.Tests/bin/Debug/net8.0/AzureStorage.QueueService.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/AzureStorage.QueueService/AzureStorage.QueueService/tests/AzureStorage.QueueService.Tests/bin/Debug/net8.0/AzureStorage.QueueService.Tests.deps.json /home/REDACTED/work/AzureStorage.QueueService/AzureStorage.QueueService/tests/AzureStorage.QueueService.Tests/bin/Debug/net8.0/testhost.dll --port 42025 --endpoint 127.0.0.1:042025 --role client --parentprocessid 4731 --telemetryoptedin false(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.