-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Azure Event Hub emulator support #4209
Conversation
7d5a362
to
01228e5
Compare
src/Components/Aspire.Azure.Messaging.EventHubs/EventHubsComponent.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsEmulatorConfigWriterHook.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsEmulatorConfigWriterHook.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsEmulatorConfigWriterHook.cs
Outdated
Show resolved
Hide resolved
src/Components/Aspire.Azure.Messaging.EventHubs/EventHubProducerClientComponent.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsEmulatorConfigWriterHook.cs
Show resolved
Hide resolved
writer.WriteStartArray("NamespaceConfig"); // "NamespaceConfig": [ | ||
writer.WriteStartObject(); // { | ||
writer.WriteString("Type", "EventHub"); // "Type": "EventHub", | ||
writer.WriteString("Name", "emulatorNs1"); // "Name": "emulatorNs1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be hardcoded like this or can this namespace be derived by the event hub resource name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There can be multiple hubs in this file.
@krishankumar_microsoft how should this resource be named? Or can we remove the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah what I'm getting at is that for each evenhub namespace in the config file ... it corresponds to a call to AddAzureEventHubs
in the app host - that resource has a name so we should use that name here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it now, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to revert this change,
Expected string to be "emulatorns1" with a length of 11 because NamespaceName is non-modifiable.Only supported emulatorns1, but "eventhubns" has a length of 10, differs near "ven" (index 1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, the team says this is hardcoded for now. So proceed as you have it.
src/Components/Aspire.Azure.Messaging.EventHubs/EventHubProducerClientComponent.cs
Outdated
Show resolved
Hide resolved
tests/Aspire.Hosting.Tests/Azure/AzureResourceExtensionsTests.cs
Outdated
Show resolved
Hide resolved
6307c72
to
7c42b66
Compare
public const string Registry = "messagingemulators.azurecr.io"; | ||
public const string Image = "microsoft/azure/eventhubs/emulator"; | ||
public const string Registry = "mcr.microsoft.com"; | ||
public const string Image = "azure-messaging/eventhubs-emulator"; | ||
public const string Tag = "latest"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there isn't a stable version number for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet https://mcr.microsoft.com/en-us/product/azure-messaging/eventhubs-emulator/tags
latest
1.2.3-preview-arm64
1.2.3-preview-amd64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: David Pine <david.pine@microsoft.com>
Co-authored-by: David Fowler <davidfowl@gmail.com>
Make sure this still works after that connection string change. |
@davidfowl E2E test is passing and tried the playground app locally too after your change which spits out the expected It is mergeable now IMO. |
/// <param name="path">Relative path to the AppHost where emulator storage is persisted between runs. Defaults to the path '.eventhubs/{builder.Resource.Name}'</param> | ||
/// <param name="isReadOnly">A flag that indicates if this is a read-only mount.</param> | ||
/// <returns>A builder for the <see cref="AzureEventHubsEmulatorResource"/>.</returns> | ||
public static IResourceBuilder<AzureEventHubsEmulatorResource> WithDataBindMount(this IResourceBuilder<AzureEventHubsEmulatorResource> builder, string? path = null, bool isReadOnly = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we have a WithDataVolume
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - what does a data folder do for Azure EventHubs? Doesn't it store all its necessary data in the Storage blobs we gave it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - what does a data folder do for Azure EventHubs? Doesn't it store all its necessary data in the Storage blobs we gave it?
The EH uses the storage blobs for managing partition leases only, not for general data (messages.) The EH client uses a storage account to hold checkpointing info.
Fixes #3412
Microsoft Reviewers: Open in CodeFlow