-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Make CheckpointStore source-shareable #17017
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
Merged
3 commits merged into
Azure:master
from
pakrym:pakrym/Make-CheckpointStore-source-shareable
Nov 17, 2020
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
227 changes: 227 additions & 0 deletions
227
...nthub/Azure.Messaging.EventHubs.Processor/src/Storage/BlobsCheckpointStore.Diagnostics.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,227 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.Messaging.EventHubs.Processor.Diagnostics; | ||
|
|
||
| namespace Azure.Messaging.EventHubs.Processor | ||
| { | ||
| /// <summary> | ||
| /// A storage blob service that keeps track of checkpoints and ownership. | ||
| /// </summary> | ||
| /// | ||
| internal sealed partial class BlobsCheckpointStore | ||
| { | ||
| /// <summary> | ||
| /// Initializes the <see cref="BlobsCheckpointStore"/> type. | ||
| /// </summary> | ||
| #pragma warning disable CA1810 // Initialize static fields inline | ||
| static BlobsCheckpointStore() | ||
| { | ||
| BlobsResourceDoesNotExist = Resources.BlobsResourceDoesNotExist; | ||
| } | ||
| #pragma warning restore CA1810 | ||
|
|
||
| /// <summary> | ||
| /// The instance of <see cref="BlobEventStoreEventSource" /> which can be mocked for testing. | ||
| /// </summary> | ||
| /// | ||
| internal BlobEventStoreEventSource Logger { get; set; } = BlobEventStoreEventSource.Log; | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to retrieve a list of ownership has completed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> | ||
| /// <param name="ownershipCount">The amount of ownership received from the storage service.</param> | ||
| /// | ||
| partial void ListOwnershipComplete(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, int ownershipCount) => | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These methods are to isolate the logging code and the BlobsCheckpointStore to be included in project that doesn't have the BlobEventStoreEventSource |
||
| Logger.ListOwnershipComplete(fullyQualifiedNamespace, eventHubName, consumerGroup, ownershipCount); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an unhandled exception was encountered while retrieving a list of ownership. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> | ||
| /// <param name="errorMessage">The message for the exception that occurred.</param> | ||
| /// | ||
| partial void ListOwnershipError(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) => | ||
| Logger.ListOwnershipError(fullyQualifiedNamespace, eventHubName, consumerGroup, errorMessage); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to retrieve a list of ownership has started. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> | ||
| /// | ||
| partial void ListOwnershipStart(string fullyQualifiedNamespace, string eventHubName, string consumerGroup) => | ||
| Logger.ListOwnershipStart(fullyQualifiedNamespace, eventHubName, consumerGroup); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to retrieve a list of checkpoints has completed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the checkpoints are associated with.</param> | ||
| /// <param name="checkpointCount">The amount of checkpoints received from the storage service.</param> | ||
| /// | ||
| partial void ListCheckpointsComplete(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, int checkpointCount) => | ||
| Logger.ListCheckpointsComplete(fullyQualifiedNamespace, eventHubName, consumerGroup, checkpointCount); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an unhandled exception was encountered while retrieving a list of checkpoints. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership are associated with.</param> | ||
| /// <param name="errorMessage">The message for the exception that occurred.</param> | ||
| /// | ||
| partial void ListCheckpointsError(string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) => | ||
| Logger.ListCheckpointsError(fullyQualifiedNamespace, eventHubName, consumerGroup, errorMessage); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that invalid checkpoint data was found during an attempt to retrieve a list of checkpoints. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition the data is associated with.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the data is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the data is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the data is associated with.</param> | ||
| /// | ||
| partial void InvalidCheckpointFound(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) => | ||
| Logger.InvalidCheckpointFound(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to retrieve a list of checkpoints has started. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoints are associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoints are associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the checkpoints are associated with.</param> | ||
| /// | ||
| partial void ListCheckpointsStart(string fullyQualifiedNamespace, string eventHubName, string consumerGroup) => | ||
| Logger.ListCheckpointsStart(fullyQualifiedNamespace, eventHubName, consumerGroup); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an unhandled exception was encountered while updating a checkpoint. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being checkpointed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> | ||
| /// <param name="errorMessage">The message for the exception that occurred.</param> | ||
| /// | ||
| partial void UpdateCheckpointError(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string errorMessage) => | ||
| Logger.UpdateCheckpointError(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, errorMessage); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to update a checkpoint has completed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being checkpointed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> | ||
| /// | ||
| partial void UpdateCheckpointComplete(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) => | ||
| Logger.UpdateCheckpointComplete(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to create/update a checkpoint has started. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being checkpointed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the checkpoint is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the checkpoint is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the checkpoint is associated with.</param> | ||
| /// | ||
| partial void UpdateCheckpointStart(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup) => | ||
| Logger.UpdateCheckpointStart(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to retrieve claim partition ownership has completed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being claimed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> | ||
| /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> | ||
| /// | ||
| partial void ClaimOwnershipComplete(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) => | ||
| Logger.ClaimOwnershipComplete(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an exception was encountered while attempting to retrieve claim partition ownership. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being claimed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> | ||
| /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> | ||
| /// <param name="errorMessage">The message for the exception that occurred.</param> | ||
| /// | ||
| partial void ClaimOwnershipError(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier, string errorMessage) => | ||
| Logger.ClaimOwnershipError(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier, errorMessage); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that ownership was unable to be claimed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being claimed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> | ||
| /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> | ||
| /// <param name="message">The message for the failure.</param> | ||
| /// | ||
| partial void OwnershipNotClaimable(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier, string message) => | ||
| Logger.OwnershipNotClaimable(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier, message); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that ownership was successfully claimed. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being claimed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> | ||
| /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> | ||
| /// | ||
| partial void OwnershipClaimed(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) => | ||
| Logger.OwnershipClaimed(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an attempt to claim a partition ownership has started. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="partitionId">The identifier of the partition being claimed.</param> | ||
| /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace the ownership is associated with. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> | ||
| /// <param name="eventHubName">The name of the specific Event Hub the ownership is associated with, relative to the Event Hubs namespace that contains it.</param> | ||
| /// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param> | ||
| /// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param> | ||
| /// | ||
| partial void ClaimOwnershipStart(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) => | ||
| Logger.ClaimOwnershipStart(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier); | ||
|
|
||
| /// <summary> | ||
| /// Indicates that a <see cref="BlobsCheckpointStore" /> was created. | ||
| /// </summary> | ||
| /// | ||
| /// <param name="typeName">The type name for the checkpoint store.</param> | ||
| /// <param name="accountName">The Storage account name corresponding to the associated container client.</param> | ||
| /// <param name="containerName">The name of the associated container client.</param> | ||
| /// | ||
| partial void BlobsCheckpointStoreCreated(string typeName, string accountName, string containerName) => | ||
| Logger.BlobsCheckpointStoreCreated(typeName, accountName, containerName); | ||
| } | ||
| } | ||
16 changes: 16 additions & 0 deletions
16
...aging.EventHubs.Shared/src/Azure.Messaging.EventHubs.Shared.BlobCheckpointStore.projitems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
| <HasSharedItems>true</HasSharedItems> | ||
| <SharedGUID>826d9924-8c85-4db1-9407-1b133a3d953f</SharedGUID> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <Import_RootNamespace>Azure.Messaging.EventHubs.Primitives</Import_RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="$(MSBuildThisfileDirectory)BlobCheckpointStore\*.cs" Link="SharedSource\BlobCheckpointStore\%(Filename)%(Extension)" /> | ||
| </ItemGroup> | ||
| </Project> |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.