Skip to content
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

Merged
merged 1 commit into from
Oct 3, 2019

Conversation

jsquire
Copy link
Member

@jsquire jsquire commented Oct 3, 2019

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

@jsquire jsquire added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Oct 3, 2019
@jsquire jsquire added this to the Sprint 159 milestone Oct 3, 2019
@jsquire jsquire self-assigned this Oct 3, 2019
Comment on lines -32 to -34
<ItemGroup>
<None Remove="Azure.Messaging.EventHubs.Reference.props" />
</ItemGroup>
Copy link
Member Author

@jsquire jsquire Oct 3, 2019

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.

Comment on lines -1865 to -1891
/// <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);
}
}
}
}

Copy link
Member Author

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.

Comment on lines -971 to -994
/// <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);
}
}
}

Copy link
Member Author

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.

@jsquire jsquire force-pushed the eventhubs/amqp-scope branch from 919e8bb to a81193b Compare October 3, 2019 18:05
Copy link
Member

@kinelski kinelski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jsquire jsquire force-pushed the eventhubs/amqp-scope branch from a81193b to 4718f51 Compare October 3, 2019 19:13
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants