AddAzureServiceBus("test").RunAsEmulator().AddServiceBusQueue("testqueue") does not create a queue
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When you create the servicebus, emulator instance... if you want multiple queues you must do something like this:
```csharp
// Configure Azure Service Bus with emulator and custom queue
var serviceBus = builder.AddAzureServiceBus("servicebustest")
.RunAsEmulator();
serviceBus.AddServiceBusQueue("welltracker");
serviceBus.AddServiceBusQueue("anotherqueue");
```
Then you add the servicebusclient like this:
```csharp
// Add Azure Service Bus client
builder.AddAzureServiceBusClient("servicebustest");
```
BUT, if you want ONE queue only, then the connection string name is the name of the queue:
```csharp
var serviceBus = builder.AddAzureServiceBus("servicebustest")
.RunAsEmulator().AddServiceBusQueue("welltracker");
...
builder.AddAzureServiceBusClient("welltracker"); // NOT servicebustest, as it does not resolve
```
**BUT in NEITHER case does it work for me...**
The docker image log (as seen in aspire dasbboard for the servicebus instance)... does NOT show it creating a queue by the name "welltracker"
It only creates a "queue.1" queue.
```ServiceBus Emulator is launching with config :{"Namespaces":[{"Name":"sbemulatorns","Queues":[{"Name":"queue.1","Properties"...```
**This simple test**
```csharp
builder.AddAzureServiceBusClient("servicebustest"); // sbcoremvp");
...
app.MapGet("/test-queue", async (ServiceBusClient serviceBusClient, ILogger logger) =>
{
try
{
var sender = serviceBusClient.CreateSender("welltracker");
var message = new ServiceBusMessage($"Test message");
await sender.SendMessageAsync(message);
```
**PRODUCES ERROR:**
```{"type":"https://tools.ietf.org/html/rfc9110#section-15.6.1","title":"Failed to send message to queue","status":500,"detail":"The messaging entity 'sb://sbemulatorns.servicebus.onebox.windows-int.net/welltracker' could not be found. ...```
simple test repo created here:
https://github.com/ERobishaw/testAspireAzureServiceBus/tree/main
### Expected Behavior
**creating a queue:**
```AddServiceBusQueue("myqueue") ```
**should create a queue that can be used like this:**
```var sender = serviceBusClient.CreateSender("myqueue");```
### Steps To Reproduce
Run the test project created here:
https://github.com/ERobishaw/testAspireAzureServiceBus/tree/main
open the dashboard, launch the API and try the endpoint:
/test-queue
It should send a test message on the queue...
### Exceptions (if any)
{"type":"https://tools.ietf.org/html/rfc9110#section-15.6.1","title":"Failed to send message to queue","status":500,"detail":"The messaging entity 'sb://sbemulatorns.servicebus.onebox.windows-int.net/welltracker' could not be found. ...
### .NET Version info
.NET SDK:
Version: 10.0.100-rc.2.25502.107
Commit: 89c8f6a112
Workload version: 10.0.100-manifests.4d32cd9e
MSBuild version: 18.0.0-preview-25502-107+89c8f6a11
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-rc.2.25502.107\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0-rc.2.25502.107
Architecture: x64
Commit: 89c8f6a112
.NET SDKs installed:
9.0.205 [C:\Program Files\dotnet\sdk]
9.0.305 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]
10.0.100-rc.2.25502.107 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.2.25502.107 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.2.25502.107 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-rc.2.25502.107 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
**.NET ASPIRE VERSION 9.5.2**
### Anything else?
**.NET ASPIRE VERSION 9.5.2**
Contributor guide
Assessment
This issue has not been assessed yet.