-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Event Hubs Client] Track Two: Fourth Preview (AMQP Receiver Scope) #7903
Conversation
<ItemGroup> | ||
<None Remove="Azure.Messaging.EventHubs.Reference.props" /> | ||
</ItemGroup> |
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.
This is no longer a thing; it was added (and removed) as part of the checkpoint store package work.
/// <summary> | ||
/// Verifies that the <see cref="EventHubConsumer" /> is able to | ||
/// connect to the Event Hubs service and perform operations. | ||
/// </summary> | ||
/// | ||
[Test] | ||
[Ignore("Expected behavior currently under discussion")] | ||
public async Task ConsumerCanReceiveWhenClientIsClosed() | ||
{ | ||
await using (EventHubScope scope = await EventHubScope.CreateAsync(1)) | ||
{ | ||
var connectionString = TestEnvironment.BuildConnectionStringForEventHub(scope.EventHubName); | ||
|
||
await using (var client = new EventHubClient(connectionString)) | ||
{ | ||
var partition = (await client.GetPartitionIdsAsync()).First(); | ||
|
||
await using (EventHubConsumer consumer = client.CreateConsumer(EventHubConsumer.DefaultConsumerGroupName, partition, EventPosition.Latest)) | ||
{ | ||
client.Close(); | ||
|
||
Assert.That(async () => await consumer.ReceiveAsync(1, TimeSpan.Zero), Throws.Nothing); | ||
} | ||
} | ||
} | ||
} | ||
|
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.
Per discussion, the service team requests that we have a 1:1 relationship between the client and AMQP connections. The client owns the connection, so when it is closed, any child consumer/producer will no longer be able to operate, by design.
/// <summary> | ||
/// Verifies that the <see cref="EventHubProducer" /> is able to | ||
/// connect to the Event Hubs service and perform operations. | ||
/// </summary> | ||
/// | ||
[Test] | ||
[Ignore("Expected behavior currently under discussion")] | ||
public async Task ProducerCanSendWhenClientIsClosed() | ||
{ | ||
await using (EventHubScope scope = await EventHubScope.CreateAsync(1)) | ||
{ | ||
var connectionString = TestEnvironment.BuildConnectionStringForEventHub(scope.EventHubName); | ||
|
||
await using (var client = new EventHubClient(connectionString)) | ||
await using (EventHubProducer producer = client.CreateProducer()) | ||
{ | ||
client.Close(); | ||
|
||
var events = new EventData(Encoding.UTF8.GetBytes("Do not delete me!")); | ||
Assert.That(async () => await producer.SendAsync(events), Throws.Nothing); | ||
} | ||
} | ||
} | ||
|
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.
Per discussion, the service team requests that we have a 1:1 relationship between the client and AMQP connections. The client owns the connection, so when it is closed, any child consumer/producer will no longer be able to operate, by design.
sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpProperty.cs
Outdated
Show resolved
Hide resolved
sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpEventHubConsumer.cs
Outdated
Show resolved
Hide resolved
919e8bb
to
a81193b
Compare
sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs
Outdated
Show resolved
Hide resolved
sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpConnectionScope.cs
Outdated
Show resolved
Hide resolved
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.
a81193b
to
4718f51
Compare
AMQP Infrastructure - Large refactoring to AMQP scope for a more consistent structure and better naming. - Fleshed out AMQP filtering, to allow setting the position for reading within the partition. - Implemenation of parent/child relationship between the AMQP scope and the connection and links that are bound to it. Disposing the scope will now cascade to the connection and active links. - Implementation of CBS authorization requests and refreshing, for non-management links. Event Hub Client - Refactored use of the AMQP scope to better manage lifespan and match behavior desired by the service team for a 1:1 correlation between connections and clients. General - Tweaks to some test timings, to reduce flakiness in nightly runs - Rename of Guard -> Argument to match the refactoring done when it was moved to Core. - Marking several tests as flaky, pending investigation and fixes. - Tweaking retry times for ARM activities in tests, in the lovely game of whack-a-mole with intermittend HTTP request failures.
4718f51
to
deeb3af
Compare
Summary
The intent of these changes is to refactor and extend the AMQP connection and link management infrastructure to support links using CBS authorization and offer creation of links for receiving events from the Event Hubs Service. Some small tweaks have also been made to help stablize tests or mark them for further investigation.
Last Upstream Rebase
Thursday, October 3, 3:11pm (EDT)
Related and Follow-Up Issues