From e855fc4bcb62b3a92515ce1bc6edb4ae2c55cfb6 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 14:18:47 -0700 Subject: [PATCH 01/37] Removed storage dependency from eventhubs --- sdk/eventhubs/CMakeLists.txt | 1 + .../CMakeLists.txt | 106 +++++++++ .../blob_checkpoint_store.hpp | 82 +++++++ .../dll_import_export.hpp | 39 ++++ .../eventhubs/checkpointstore_blob/rtti.hpp | 36 +++ .../src/blob_checkpoint_store.cpp | 219 ++++++++++++++++++ .../src/private/package_version.hpp | 69 ++++++ .../test/CMakeLists.txt | 54 +++++ .../test/checkpoint_store_test.cpp | 160 +++++++++++++ .../test/eventhubs_test_base.hpp | 21 ++ .../vcpkg/Config.cmake.in | 13 ++ .../vcpkg/portfile.cmake | 22 ++ .../vcpkg/vcpkg.json | 38 +++ .../azure-messaging-eventhubs/CMakeLists.txt | 6 +- .../messaging/eventhubs/checkpoint_store.hpp | 65 ------ .../models/checkpoint_store_models.hpp | 2 +- .../azure/messaging/eventhubs/processor.hpp | 14 +- .../src/checkpoint_store.cpp | 208 +---------------- .../test/ut/checkpoint_store_test.cpp | 13 +- .../test/ut/processor_test.cpp | 12 +- 20 files changed, 880 insertions(+), 300 deletions(-) create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json diff --git a/sdk/eventhubs/CMakeLists.txt b/sdk/eventhubs/CMakeLists.txt index 4cf10b5b71..ab59299748 100644 --- a/sdk/eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/CMakeLists.txt @@ -9,3 +9,4 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_subdirectory(azure-messaging-eventhubs) +add_subdirectory(azure-messaging-eventhubs-checkpointstore-blob) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt new file mode 100644 index 0000000000..00eeb7887e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") +include(AzureVcpkg) +az_vcpkg_integrate() + +cmake_minimum_required (VERSION 3.13) +project(azure-messaging-eventhubs-checkpoint-blob LANGUAGES CXX) + +# Compile Options +option(FETCH_SOURCE_DEPS "build source dependencies" OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +if(FETCH_SOURCE_DEPS) + set(AZ_ALL_LIBRARIES ON) + include(FolderList) + SetCompileOptions(EVENTHUBS) +endif() + +include(AzureVersion) +include(AzureCodeCoverage) +include(AzureTransportAdapters) +include(AzureDoxygen) +include(AzureGlobalCompileOptions) +include(AzureConfigRTTI) +include(AzureBuildTargetForCI) +# Add create_map_file function +include(CreateMapFile) + +if(FETCH_SOURCE_DEPS) + GetFolderList(EVENTHUBS) + foreach(oneFolder IN LISTS BUILD_FOLDERS) + message("add folder ${oneFolder}") + add_subdirectory(${oneFolder} EXCLUDE_FROM_ALL) + endforeach() +elseif(NOT AZ_ALL_LIBRARIES) + find_package(azure-core-cpp CONFIG QUIET) + if(NOT azure-core-cpp_FOUND) + find_package(azure-core-cpp REQUIRED) + endif() + + find_package(azure-messaging-eventhubs-cpp CONFIG QUIET) + if(NOT azure-core-cpp_FOUND) + find_package(azure-messaging-eventhubs-cpp REQUIRED) + endif() + + find_package(azure-storage-blobs-cpp CONFIG QUIET) + if(NOT azure-storage-blobs-cpp_FOUND) + find_package(azure-storage-blobs-cpp REQUIRED) + endif() +endif() + +set( + AZURE_MESSAGING_EVENTHUBS_BLOB_CHECKPOINT_HEADER + inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp +) + +set( + AZURE_MESSAGING_EVENTHUBS_BLOB_CHECKPOINT_SOURCE + src/blob_checkpoint_store.cpp +) + +add_library( + azure-messaging-eventhubs-checkpoint-blob + ${AZURE_MESSAGING_EVENTHUBS_BLOB_CHECKPOINT_HEADER} ${AZURE_MESSAGING_EVENTHUBS_BLOB_CHECKPOINT_SOURCE} +) +create_per_service_target_build(eventhubs azure-messaging-eventhubs-checkpoint-blob) +add_library(Azure::azure-messaging-eventhubs-checkpoint-blob ALIAS azure-messaging-eventhubs-checkpoint-blob) + +target_include_directories( + azure-messaging-eventhubs-checkpoint-blob + PUBLIC + $ + $ +) + +target_link_libraries(azure-messaging-eventhubs-checkpoint-blob + PUBLIC Azure::azure-core Azure::azure-messaging-eventhubs Azure::azure-storage-blobs +) + +# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF +create_code_coverage(azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob "tests?/*;samples?/*") + +get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) + +add_subdirectory(test) + +az_vcpkg_export( + azure-messaging-eventhubs-checkpoint-blob + MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB + azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp + ) + +az_rtti_setup( + azure-messaging-eventhubs-checkpoint-blob + MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB + azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp +) + +unset(FETCH_SOURCE_DEPS CACHE) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp new file mode 100644 index 0000000000..2bdb19d350 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace Azure { namespace Messaging { namespace EventHubs { + + /** @brief BlobCheckpointStore is an implementation of a CheckpointStore backed by Azure Blob + * Storage. + */ + class BlobCheckpointStore final : public Azure::Messaging::EventHubs::CheckpointStore { + Azure::Storage::Blobs::BlobContainerClient m_containerClient; + + void UpdateCheckpointImpl( + Azure::Storage::Metadata const& metadata, + Models::Checkpoint& checkpoint); + + void UpdateOwnership( + Azure::Storage::Blobs::Models::BlobItem const& blob, + Models::Ownership& ownership); + + Azure::Storage::Metadata CreateCheckpointBlobMetadata(Models::Checkpoint const& checkpoint); + + std::pair SetMetadata( + std::string const& blobName, + Azure::Storage::Metadata const& metadata, + Azure::ETag const& etag, + Core::Context const& context = {}); + + public: + /** @brief Construct a BlobCheckpointStore from another BlobCheckpointStore. + */ + BlobCheckpointStore(BlobCheckpointStore const& other) = default; + + /** @brief Assign a BlobCheckpointStore to another BlobCheckpointStore. + */ + BlobCheckpointStore& operator=(BlobCheckpointStore const& other) = default; + + /**@brief Construct a BlobCheckpointStore. + * + * @param containerClient An Azure Blob ContainerClient used to hold the checkpoints. + */ + BlobCheckpointStore(Azure::Storage::Blobs::BlobContainerClient const& containerClient) + : Azure::Messaging::EventHubs::CheckpointStore(), m_containerClient(containerClient) + { + m_containerClient.CreateIfNotExists(); + } + + std::vector ClaimOwnership( + std::vector const& partitionOwnership, + Core::Context const& context = {}) override; + + std::vector ListCheckpoints( + std::string const& fullyQualifiedNamespace, + std::string const& eventHubName, + std::string const& consumerGroup, + Core::Context const& context = {}) override; + + /**@brief ListOwnership lists all ownerships. + */ + std::vector ListOwnership( + std::string const& fullyQualifiedNamespace, + std::string const& eventHubName, + std::string const& consumerGroup, + Core::Context const& context = {}) override; + + /**@brief UpdateCheckpoint updates a specific checkpoint with a sequence and offset. + */ + void UpdateCheckpoint(Models::Checkpoint const& checkpoint, Core::Context const& context = {}) + override; + }; +}}} // namespace Azure::Messaging::EventHubs diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp new file mode 100644 index 0000000000..d82dff41e2 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @file + * @brief DLL export macro. + */ + +// For explanation, see the comment in azure/core/dll_import_export.hpp + +#pragma once + +/** + * @def AZ_MESSAGING_EVENTHUBS_DLLEXPORT + * @brief Applies DLL export attribute, when applicable. + * @note See https://docs.microsoft.com/cpp/cpp/dllexport-dllimport?view=msvc-160. + */ + +#if defined(AZ_MESSAGING_EVENTHUBS_DLL) || (0 /*@AZ_MESSAGING_EVENTHUBS_DLL_INSTALLED_AS_PACKAGE@*/) +#define AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL 1 +#else +#define AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL 0 +#endif + +#if AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL +#if defined(_MSC_VER) +#if defined(AZ_MESSAGING_EVENTHUBS_BEING_BUILT) +#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT __declspec(dllexport) +#else // !defined(AZ_MESSAGING_EVENTHUBS_BEING_BUILT) +#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT __declspec(dllimport) +#endif // AZ_MESSAGING_EVENTHUBS_BEING_BUILT +#else // !defined(_MSC_VER) +#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT +#endif // _MSC_VER +#else // !AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL +#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT +#endif // AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL + +#undef AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp new file mode 100644 index 0000000000..df85ef610e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @file + * @brief Run-time type info enable or disable. + * + * @details Checks whenever RTTI is enabled and exports the symbol + * `AZ_MESSAGING_EVENTHUBS_RTTI`. When the macro is not defined, RTTI is disabled. + * + * @details Each library has this header file. These headers are being configured by + * `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending + * on the build flags. + */ + +#pragma once + +/** + * @def AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_RTTI + * @brief A macro indicating whether the code is built with RTTI or not. + * + * @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after + * the build is completed, that information is not preserved for the code that consumes Azure SDK + * headers, unless the code that consumes the SDK is the part of the same build process. To address + * this issue, CMake install would patch the header it places in the installation directory, so that + * condition: + * `#if defined(AZ_RTTI) || (0)` + * becomes, effectively, + * `#if defined(AZ_RTTI) || (0 + 1)` + * when the library was built with RTTI support, and will make no changes to the + * condition when it was not. + */ + +#if defined(AZ_RTTI) || (0 /*@AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_RTTI@*/) +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_RTTI +#endif diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp new file mode 100644 index 0000000000..9653e06d4c --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +#include "azure/messaging/eventhubs/checkpoint_store.hpp" +#include "azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp" + +#include + +#include + +using namespace Azure::Messaging::EventHubs::Models; + + +void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateCheckpointImpl( + Azure::Storage::Metadata const& metadata, + Checkpoint& checkpoint) +{ + std::string temp = metadata.at("sequencenumber"); + if (temp.empty()) + { + throw std::runtime_error("missing sequence number"); + } + checkpoint.SequenceNumber = std::stol(temp); + + temp = metadata.at("offset"); + if (temp.empty()) + { + throw std::runtime_error("missing offset number"); + } + + checkpoint.Offset = std::stol(temp); +} + +void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateOwnership( + Azure::Storage::Blobs::Models::BlobItem const& blob, + Ownership& ownership) +{ + std::string temp = blob.Details.Metadata.at("ownerid"); + if (temp.empty()) + { + throw std::runtime_error("missing sequence number"); + } + ownership.OwnerId = temp; + ownership.LastModifiedTime = blob.Details.LastModified; + ownership.ETag = blob.Details.ETag; +} + +Azure::Storage::Metadata +Azure::Messaging::EventHubs::BlobCheckpointStore::CreateCheckpointBlobMetadata( + Checkpoint const& checkpoint) +{ + Azure::Storage::Metadata metadata; + + if (checkpoint.SequenceNumber.HasValue()) + { + metadata["sequencenumber"] = std::to_string(checkpoint.SequenceNumber.Value()); + } + + if (checkpoint.Offset.HasValue()) + { + metadata["offset"] = std::to_string(checkpoint.Offset.Value()); + } + return metadata; +} + +std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ClaimOwnership( + std::vector const& partitionOwnership, + Core::Context const& context) +{ + std::vector newOwnerships; + + for (Ownership ownership : partitionOwnership) + { + std::string blobName = ownership.GetOwnershipName(); + Azure::Storage::Metadata metadata; + metadata["ownerId"] = ownership.OwnerId; + try + { + std::pair result + = SetMetadata(blobName, metadata, ownership.ETag.ValueOr(Azure::ETag()), context); + if (result.second.HasValue()) + { + + Ownership newOwnership(ownership); + newOwnership.ETag = result.second; + newOwnership.LastModifiedTime = result.first; + newOwnerships.emplace_back(newOwnership); + } + } + catch (...) + { + // we can fail to claim ownership and that's okay - it's expected that clients will + // attempt to claim with whatever state they hold locally. If they fail it just means + // someone else claimed ownership before them. + continue; + } + } + return newOwnerships; +} + +std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ListCheckpoints( + std::string const& fullyQualifiedNamespace, + std::string const& eventHubName, + std::string const& consumerGroup, + Core::Context const& context) +{ + std::vector checkpoints; + + std::string prefix = Models::Checkpoint{consumerGroup, eventHubName, fullyQualifiedNamespace} + .GetCheckpointBlobPrefixName(); + Azure::Storage::Blobs::ListBlobsOptions listOptions; + listOptions.Prefix = prefix; + listOptions.Include = Azure::Storage::Blobs::Models::ListBlobsIncludeFlags::Metadata; + for (auto page = m_containerClient.ListBlobs(listOptions, context); page.HasPage(); + page.MoveToNextPage()) + { + for (auto& blob : page.Blobs) + { + std::string partitionId = blob.Name.substr(blob.Name.rfind('/') + 1); + Checkpoint c = Checkpoint{consumerGroup, eventHubName, fullyQualifiedNamespace, partitionId}; + UpdateCheckpointImpl(blob.Details.Metadata, c); + checkpoints.push_back(c); + } + } + + return checkpoints; +} + +/**@brief ListOwnership lists all ownerships. + */ +std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ListOwnership( + std::string const& fullyQualifiedNamespace, + std::string const& eventHubName, + std::string const& consumerGroup, + Core::Context const& context) +{ + std::vector ownerships; + std::string prefix + = Ownership{consumerGroup, eventHubName, fullyQualifiedNamespace}.GetOwnershipPrefixName(); + Azure::Storage::Blobs::ListBlobsOptions listOptions; + listOptions.Prefix = prefix; + listOptions.Include = Azure::Storage::Blobs::Models::ListBlobsIncludeFlags::Metadata; + + for (auto page = m_containerClient.ListBlobs(listOptions, context); page.HasPage(); + page.MoveToNextPage()) + { + for (auto& blob : page.Blobs) + { + std::string partitionId = blob.Name.substr(blob.Name.rfind('/') + 1); + Ownership o{consumerGroup, eventHubName, fullyQualifiedNamespace, partitionId}; + UpdateOwnership(blob, o); + ownerships.push_back(o); + } + } + + return ownerships; +} + +/**@brief UpdateCheckpoint updates a specific checkpoint with a sequence and offset. + */ +void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateCheckpoint( + Checkpoint const& checkpoint, + Core::Context const& context) +{ + std::string blobName = checkpoint.GetCheckpointBlobName(); + SetMetadata(blobName, CreateCheckpointBlobMetadata(checkpoint), Azure::ETag(), context); +} + +std::pair +Azure::Messaging::EventHubs::BlobCheckpointStore::SetMetadata( + std::string const& blobName, + Azure::Storage::Metadata const& metadata, + Azure::ETag const& etag, + Core::Context const& context) +{ + auto blobClient = m_containerClient.GetBlockBlobClient(blobName); + std::pair returnValue; + Azure::Storage::Blobs::SetBlobMetadataOptions options; + + try + { + if (etag.HasValue()) + { + options.AccessConditions.IfMatch = etag; + } + + Azure::Storage::Blobs::Models::SetBlobMetadataResult result + = blobClient.SetMetadata(metadata, options, context).Value; + + returnValue = std::make_pair(result.LastModified, result.ETag); + } + catch (Azure::Core::RequestFailedException const& ex) + { + // Ignore HTTP code 412 meaning condition could not be met; + if (ex.StatusCode == Azure::Core::Http::HttpStatusCode::PreconditionFailed) + { + } + if (ex.StatusCode == Azure::Core::Http::HttpStatusCode::NotFound) + { + Azure::Core::Diagnostics::_internal::Log::Write( + Azure::Core::Diagnostics::Logger::Level::Warning, + "Set Metadata failed with PreconditionFailed or NotFound.; Upload blob content"); + + std::string blobContent = ""; + // throws when blob does not exist , we need to upload the blob in order to create it + std::vector buffer(blobContent.begin(), blobContent.end()); + Azure::Storage::Blobs::UploadBlockBlobFromOptions upOptions; + upOptions.Metadata = metadata; + Azure::Storage::Blobs::Models::UploadBlockBlobFromResult result + = blobClient.UploadFrom(buffer.data(), buffer.size(), upOptions, context).Value; + returnValue = std::make_pair(result.LastModified, result.ETag); + } + else + { + throw; + } + } + + return returnValue; +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp new file mode 100644 index 0000000000..e064948799 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @file + * @brief Provides version information. + */ + +#pragma once + +#include + +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MAJOR 1 +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MINOR 0 +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PATCH 0 +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PRERELEASE "beta.1" + +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER(i) #i +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(i) AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER(i) + +namespace Azure { namespace Messaging { namespace EventHubs { namespace _detail { + /** + * @brief Provides version information. + */ + class PackageVersion final { + public: + /** + * @brief Major numeric identifier. + */ + static constexpr int32_t Major = AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MAJOR; + + /** + * @brief Minor numeric identifier. + */ + static constexpr int32_t Minor = AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MINOR; + + /** + * @brief Patch numeric identifier. + */ + static constexpr int32_t Patch = AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PATCH; + + /** + * @brief Indicates whether the SDK is in a pre-release state. + */ + static constexpr bool IsPreRelease + = sizeof(AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PRERELEASE) != sizeof(""); + + /** + * @brief The version in string format used for telemetry following the `semver.org` + * standard (https://semver.org). + */ + static constexpr const char* ToString() + { + return IsPreRelease + ? AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MAJOR) "." AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA( + AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MINOR) "." AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PATCH) "-" AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PRERELEASE + : AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MAJOR) "." AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA( + AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MINOR) "." AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PATCH); + } + }; +}}}} // namespace Azure::Messaging::EventHubs::_detail + +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA + +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MAJOR +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_MINOR +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PATCH +#undef AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PRERELEASE diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt new file mode 100644 index 0000000000..a571aa6d0e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +cmake_minimum_required (VERSION 3.13) + +project (azure-messaging-eventhubs-blobcheckpointstore-test LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +include(GoogleTest) + +# Export the test folder for recordings access. +add_compile_definitions(AZURE_TEST_RECORDING_DIR="${CMAKE_CURRENT_LIST_DIR}") +include(TestProxyPrep) +SetUpTestProxy("sdk/eventhubs") + +################## Unit Tests ########################## +add_executable ( + azure-messaging-eventhubs-blobcheckpointstore-test + checkpoint_store_test.cpp +) + +create_per_service_target_build(eventhubs azure-messaging-eventhubs-blobcheckpointstore-test) +create_map_file(azure-messaging-eventhubs-test azure-messaging-eventhubs-blobcheckpointstore-test.map) + +if (MSVC) + target_compile_options(azure-messaging-eventhubs-blobcheckpointstore-test PUBLIC /wd6326 /wd26495 /wd26812) +endif() + +target_link_libraries( + azure-messaging-eventhubs-blobcheckpointstore-test + PRIVATE + azure-messaging-eventhubs + azure-messaging-eventhubs-checkpoint-blob + azure-core-test-fw + azure-identity + gtest + gtest_main + gmock +) + +# Adding private headers so we can test the private APIs with no relative paths include. +target_include_directories ( + azure-messaging-eventhubs-blobcheckpointstore-test + PRIVATE + $) + +# gtest_add_tests will scan the test from azure-messaging-eventhubs-test and call add_test +# for each test to ctest. This enables `ctest -r` to run specific tests directly. +gtest_discover_tests(azure-messaging-eventhubs-blobcheckpointstore-test + TEST_PREFIX azure-messaging-eventhubs. + NO_PRETTY_TYPES + NO_PRETTY_VALUES + DISCOVERY_TIMEOUT 600) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp new file mode 100644 index 0000000000..86caf0f8f3 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#include "eventhubs_test_base.hpp" +#include "azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp" + +#include +#include +#include + +#include + +namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { + + class CheckpointStoreTest : public EventHubsTestBase { + virtual void SetUp() override + { + EventHubsTestBase::SetUp(); + m_blobClientOptions = InitClientOptions(); + } + + protected: + std::string GetRandomName() + { + std::string name = "checkpoint"; + if (m_testContext.IsLiveMode()) + { + name.append(Azure::Core::Uuid::CreateUuid().ToString()); + } + else + { + name.append("-recording"); + } + return name; + } + + Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions; + }; + + TEST_F(CheckpointStoreTest, TestCheckpoints) + { + std::string const testName = GetRandomName(); + std::string consumerGroup = GetEnv("EVENTHUB_CONSUMER_GROUP"); + auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( + GetEnv("CHECKPOINTSTORE_STORAGE_CONNECTION_STRING"), testName, m_blobClientOptions)}; + Azure::Messaging::EventHubs::BlobCheckpointStore checkpointStore(containerClient); + + auto checkpoints = checkpointStore.ListCheckpoints( + "fully-qualified-namespace", "event-hub-name", "consumer-group"); + + EXPECT_EQ(0ul, checkpoints.size()); + + checkpointStore.UpdateCheckpoint(Azure::Messaging::EventHubs::Models::Checkpoint{ + consumerGroup, + "event-hub-name", + "ns.servicebus.windows.net", + "partition-id", + 101, + 202, + }); + + checkpoints = checkpointStore.ListCheckpoints( + "ns.servicebus.windows.net", "event-hub-name", consumerGroup); + EXPECT_EQ(checkpoints.size(), 1ul); + EXPECT_EQ(consumerGroup, checkpoints[0].ConsumerGroup); + EXPECT_EQ("event-hub-name", checkpoints[0].EventHubName); + EXPECT_EQ("ns.servicebus.windows.net", checkpoints[0].FullyQualifiedNamespaceName); + EXPECT_EQ("partition-id", checkpoints[0].PartitionId); + EXPECT_EQ(202, checkpoints[0].SequenceNumber.Value()); + EXPECT_EQ(101, checkpoints[0].Offset.Value()); + + checkpointStore.UpdateCheckpoint(Azure::Messaging::EventHubs::Models::Checkpoint{ + consumerGroup, + "event-hub-name", + "ns.servicebus.windows.net", + "partition-id", + 102, + 203, + }); + + checkpoints = checkpointStore.ListCheckpoints( + "ns.servicebus.windows.net", "event-hub-name", consumerGroup); + EXPECT_EQ(checkpoints.size(), 1ul); + EXPECT_EQ(consumerGroup, checkpoints[0].ConsumerGroup); + EXPECT_EQ("event-hub-name", checkpoints[0].EventHubName); + EXPECT_EQ("ns.servicebus.windows.net", checkpoints[0].FullyQualifiedNamespaceName); + EXPECT_EQ("partition-id", checkpoints[0].PartitionId); + EXPECT_EQ(203, checkpoints[0].SequenceNumber.Value()); + EXPECT_EQ(102, checkpoints[0].Offset.Value()); + } + + TEST_F(CheckpointStoreTest, TestOwnerships) + { + std::string const testName = GetRandomName(); + auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( + GetEnv("CHECKPOINTSTORE_STORAGE_CONNECTION_STRING"), testName, m_blobClientOptions)}; + + Azure::Messaging::EventHubs::BlobCheckpointStore checkpointStore(containerClient); + + auto ownerships = checkpointStore.ListOwnership( + "fully-qualified-namespace", "event-hub-name", "consumer-group"); + EXPECT_EQ(0ul, ownerships.size()); + + ownerships = checkpointStore.ClaimOwnership( + std::vector{}); + EXPECT_EQ(0ul, ownerships.size()); + + ownerships = checkpointStore.ClaimOwnership( + std::vector{ + Azure::Messaging::EventHubs::Models::Ownership{ + "$Default", + "event-hub-name", + "ns.servicebus.windows.net", + "partition-id", + "owner-id"}}); + + // Fail the test immediately if there isn't an entry in the ownerships vector. + ASSERT_EQ(1ul, ownerships.size()); + EXPECT_EQ("$Default", ownerships[0].ConsumerGroup); + EXPECT_EQ("event-hub-name", ownerships[0].EventHubName); + EXPECT_EQ("ns.servicebus.windows.net", ownerships[0].FullyQualifiedNamespace); + EXPECT_EQ("partition-id", ownerships[0].PartitionId); + EXPECT_EQ("owner-id", ownerships[0].OwnerId); + EXPECT_TRUE(ownerships[0].ETag.HasValue()); + EXPECT_TRUE(ownerships[0].LastModifiedTime.HasValue()); + Azure::ETag validEtag = ownerships[0].ETag.Value(); + // Azure::DateTime lastDatetime = ownerships[0].LastModifiedTime.Value(); + // + // This ownership should NOT take precedence over the previous ownership, so the set of + // ownerships returned should be empty. + ownerships = checkpointStore.ClaimOwnership( + std::vector{ + Azure::Messaging::EventHubs::Models::Ownership{ + "$Default", + "event-hub-name", + "ns.servicebus.windows.net", + "partition-id", + "owner-id", + Azure::ETag("randomETAG")}}); + EXPECT_EQ(0ul, ownerships.size()); + + ownerships = checkpointStore.ClaimOwnership( + std::vector{ + Azure::Messaging::EventHubs::Models::Ownership{ + "$Default", + "event-hub-name", + "ns.servicebus.windows.net", + "partition-id", + "owner-id", + validEtag}}); + + EXPECT_EQ(1ul, ownerships.size()); + EXPECT_NE(validEtag, ownerships[0].ETag.Value()); + EXPECT_EQ("$Default", ownerships[0].ConsumerGroup); + EXPECT_EQ("event-hub-name", ownerships[0].EventHubName); + EXPECT_EQ("ns.servicebus.windows.net", ownerships[0].FullyQualifiedNamespace); + EXPECT_EQ("partition-id", ownerships[0].PartitionId); + EXPECT_EQ("owner-id", ownerships[0].OwnerId); + } +}}}} // namespace Azure::Messaging::EventHubs::Test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp new file mode 100644 index 0000000000..5af8ebc896 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#include "gtest/gtest.h" + +#include + +class EventHubsTestBase : public Azure::Core::Test::TestBase { +public: + EventHubsTestBase() { TestBase::SetUpTestSuiteLocal(AZURE_TEST_ASSETS_DIR); } + // Create + virtual void SetUp() override + { + Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR); + } + virtual void TearDown() override + { + // Make sure you call the base classes TearDown method to ensure recordings are made. + TestBase::TearDown(); + } +}; diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in new file mode 100644 index 0000000000..274fdcdd1f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in @@ -0,0 +1,13 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(azure-core-amqp-cpp) +find_dependency(azure-messaging-eventhubs-cpp) +find_dependency(azure-storage-blobs-cpp) + +include("${CMAKE_CURRENT_LIST_DIR}/azure-messaging-eventhubs-checkpointstore-blob-cppTargets.cmake") + +check_required_components("azure-messaging-eventhubs-checkpointstore-blob-cpp") diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake new file mode 100644 index 0000000000..013cf22caf --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake @@ -0,0 +1,22 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Azure/azure-sdk-for-cpp + REF azure-messaging-eventhubs-checkpointstore-blob_@AZ_LIBRARY_VERSION@ + SHA512 0 +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/sdk/eventhubs/azure-messaging-eventhubs/" + OPTIONS + -DWARNINGS_AS_ERRORS=OFF + -DBUILD_TESTING=OFF +) + +vcpkg_cmake_install() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_cmake_config_fixup() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +vcpkg_copy_pdbs() diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json new file mode 100644 index 0000000000..68420a6749 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json @@ -0,0 +1,38 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +{ + "name": "azure-messaging-eventhubs-checkpointstore-blob-cpp", + "version-semver": "@AZ_LIBRARY_VERSION@", + "description": [ + "Microsoft Azure Messaging Event Hubs SDK for C++ Blob Checkpoint Store", + "This library provides an Azure-Storage-Blobs based implementation of an Azure Messaging Event Hubs SDK Checkpoint Store." + ], + "homepage": "https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/eventhubs/azure-messaging-eventhubs", + "license": "MIT", + "dependencies": [ + { + "name": "azure-core-amqp-cpp", + "default-features": false, + "version>=": "1.0.0-beta.2" + }, + { + "name": "azure-messaging-eventhubs", + "default-features": false, + "version>=": "1.0.0-beta.2" + }, + { + "name": "azure-storage-blobs-cpp", + "default-features": false, + "version>=": "12.8.0" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt index 062adf86b7..8ee7598e25 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt @@ -49,10 +49,6 @@ elseif(NOT AZ_ALL_LIBRARIES) find_package(azure-core-amqp-cpp REQUIRED) endif() - find_package(azure-storage-blobs-cpp CONFIG QUIET) - if(NOT azure-storage-blobs-cpp_FOUND) - find_package(azure-storage-blobs-cpp REQUIRED) - endif() endif() set( @@ -110,7 +106,7 @@ target_include_directories( $ ) -target_link_libraries(azure-messaging-eventhubs PUBLIC Azure::azure-core Azure::azure-core-amqp Azure::azure-storage-blobs) +target_link_libraries(azure-messaging-eventhubs PUBLIC Azure::azure-core Azure::azure-core-amqp) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF create_code_coverage(eventhubs azure-messaging-eventhubs azure-messaging-eventhubs-test "tests?/*;samples?/*") diff --git a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/checkpoint_store.hpp b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/checkpoint_store.hpp index 3097c55c75..00bdb4e88b 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/checkpoint_store.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/checkpoint_store.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -65,68 +64,4 @@ namespace Azure { namespace Messaging { namespace EventHubs { virtual ~CheckpointStore() = default; }; - /** @brief BlobCheckpointStore is an implementation of a CheckpointStore backed by Azure Blob - * Storage. - */ - class BlobCheckpointStore final : public CheckpointStore { - Azure::Storage::Blobs::BlobContainerClient m_containerClient; - - void UpdateCheckpointImpl( - Azure::Storage::Metadata const& metadata, - Models::Checkpoint& checkpoint); - - void UpdateOwnership( - Azure::Storage::Blobs::Models::BlobItem const& blob, - Models::Ownership& ownership); - - Azure::Storage::Metadata CreateCheckpointBlobMetadata(Models::Checkpoint const& checkpoint); - - std::pair SetMetadata( - std::string const& blobName, - Azure::Storage::Metadata const& metadata, - Azure::ETag const& etag, - Core::Context const& context = {}); - - public: - /** @brief Construct a BlobCheckpointStore from another BlobCheckpointStore. - */ - BlobCheckpointStore(BlobCheckpointStore const& other) = default; - - /** @brief Assign a BlobCheckpointStore to another BlobCheckpointStore. - */ - BlobCheckpointStore& operator=(BlobCheckpointStore const& other) = default; - - /**@brief Construct a BlobCheckpointStore. - * - * @param containerClient An Azure Blob ContainerClient used to hold the checkpoints. - */ - BlobCheckpointStore(Azure::Storage::Blobs::BlobContainerClient const& containerClient) - : CheckpointStore(), m_containerClient(containerClient) - { - m_containerClient.CreateIfNotExists(); - } - - std::vector ClaimOwnership( - std::vector const& partitionOwnership, - Core::Context const& context = {}) override; - - std::vector ListCheckpoints( - std::string const& fullyQualifiedNamespace, - std::string const& eventHubName, - std::string const& consumerGroup, - Core::Context const& context = {}) override; - - /**@brief ListOwnership lists all ownerships. - */ - std::vector ListOwnership( - std::string const& fullyQualifiedNamespace, - std::string const& eventHubName, - std::string const& consumerGroup, - Core::Context const& context = {}) override; - - /**@brief UpdateCheckpoint updates a specific checkpoint with a sequence and offset. - */ - void UpdateCheckpoint(Models::Checkpoint const& checkpoint, Core::Context const& context = {}) - override; - }; }}} // namespace Azure::Messaging::EventHubs diff --git a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp index f8e153a605..202fc6956c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp index dc79a89beb..bd7eeb6e24 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp @@ -130,7 +130,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { * * @param context The context to control the request lifetime. */ - void Run(Core::Context const& context = {}) + void Run(Core::Context const& context) { Models::EventHubProperties eventHubProperties = m_consumerClient->GetEventHubProperties(context); @@ -140,12 +140,12 @@ namespace Azure { namespace Messaging { namespace EventHubs { // = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); // const auto current = std::chrono::system_clock::from_time_t(timeNowSeconds); - // TODO : this is where we re load balance on the update interval - /* while (!context.IsCancelled()) - { - std::this_thread::sleep_for(m_ownershipUpdateInterval); - Dispatch(eventHubProperties, consumers, context); - }*/ + //// TODO : this is where we re load balance on the update interval + //while (!context.IsCancelled()) + //{ + // std::this_thread::sleep_for(m_ownershipUpdateInterval); + // Dispatch(eventHubProperties, consumers, context); + //} } /** @brief Dispatches events to the appropriate partition clients. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp index f657f726f3..9dfe67619e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp @@ -3,6 +3,7 @@ #include "azure/messaging/eventhubs/checkpoint_store.hpp" #include +#include #include @@ -56,210 +57,3 @@ std::string Azure::Messaging::EventHubs::Models::Checkpoint::GetCheckpointBlobNa return GetCheckpointBlobPrefixName() + PartitionId; } -void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateCheckpointImpl( - Azure::Storage::Metadata const& metadata, - Checkpoint& checkpoint) -{ - std::string temp = metadata.at("sequencenumber"); - if (temp.empty()) - { - throw std::runtime_error("missing sequence number"); - } - checkpoint.SequenceNumber = std::stol(temp); - - temp = metadata.at("offset"); - if (temp.empty()) - { - throw std::runtime_error("missing offset number"); - } - - checkpoint.Offset = std::stol(temp); -} - -void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateOwnership( - Azure::Storage::Blobs::Models::BlobItem const& blob, - Ownership& ownership) -{ - std::string temp = blob.Details.Metadata.at("ownerid"); - if (temp.empty()) - { - throw std::runtime_error("missing sequence number"); - } - ownership.OwnerId = temp; - ownership.LastModifiedTime = blob.Details.LastModified; - ownership.ETag = blob.Details.ETag; -} - -Azure::Storage::Metadata -Azure::Messaging::EventHubs::BlobCheckpointStore::CreateCheckpointBlobMetadata( - Checkpoint const& checkpoint) -{ - Azure::Storage::Metadata metadata; - - if (checkpoint.SequenceNumber.HasValue()) - { - metadata["sequencenumber"] = std::to_string(checkpoint.SequenceNumber.Value()); - } - - if (checkpoint.Offset.HasValue()) - { - metadata["offset"] = std::to_string(checkpoint.Offset.Value()); - } - return metadata; -} - -std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ClaimOwnership( - std::vector const& partitionOwnership, - Core::Context const& context) -{ - std::vector newOwnerships; - - for (Ownership ownership : partitionOwnership) - { - std::string blobName = ownership.GetOwnershipName(); - Azure::Storage::Metadata metadata; - metadata["ownerId"] = ownership.OwnerId; - try - { - std::pair result - = SetMetadata(blobName, metadata, ownership.ETag.ValueOr(Azure::ETag()), context); - if (result.second.HasValue()) - { - - Ownership newOwnership(ownership); - newOwnership.ETag = result.second; - newOwnership.LastModifiedTime = result.first; - newOwnerships.emplace_back(newOwnership); - } - } - catch (...) - { - // we can fail to claim ownership and that's okay - it's expected that clients will - // attempt to claim with whatever state they hold locally. If they fail it just means - // someone else claimed ownership before them. - continue; - } - } - return newOwnerships; -} - -std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ListCheckpoints( - std::string const& fullyQualifiedNamespace, - std::string const& eventHubName, - std::string const& consumerGroup, - Core::Context const& context) -{ - std::vector checkpoints; - - std::string prefix = Models::Checkpoint{consumerGroup, eventHubName, fullyQualifiedNamespace} - .GetCheckpointBlobPrefixName(); - Azure::Storage::Blobs::ListBlobsOptions listOptions; - listOptions.Prefix = prefix; - listOptions.Include = Azure::Storage::Blobs::Models::ListBlobsIncludeFlags::Metadata; - for (auto page = m_containerClient.ListBlobs(listOptions, context); page.HasPage(); - page.MoveToNextPage()) - { - for (auto& blob : page.Blobs) - { - std::string partitionId = blob.Name.substr(blob.Name.rfind('/') + 1); - Checkpoint c = Checkpoint{consumerGroup, eventHubName, fullyQualifiedNamespace, partitionId}; - UpdateCheckpointImpl(blob.Details.Metadata, c); - checkpoints.push_back(c); - } - } - - return checkpoints; -} - -/**@brief ListOwnership lists all ownerships. - */ -std::vector Azure::Messaging::EventHubs::BlobCheckpointStore::ListOwnership( - std::string const& fullyQualifiedNamespace, - std::string const& eventHubName, - std::string const& consumerGroup, - Core::Context const& context) -{ - std::vector ownerships; - std::string prefix - = Ownership{consumerGroup, eventHubName, fullyQualifiedNamespace}.GetOwnershipPrefixName(); - Azure::Storage::Blobs::ListBlobsOptions listOptions; - listOptions.Prefix = prefix; - listOptions.Include = Azure::Storage::Blobs::Models::ListBlobsIncludeFlags::Metadata; - - for (auto page = m_containerClient.ListBlobs(listOptions, context); page.HasPage(); - page.MoveToNextPage()) - { - for (auto& blob : page.Blobs) - { - std::string partitionId = blob.Name.substr(blob.Name.rfind('/') + 1); - Ownership o{consumerGroup, eventHubName, fullyQualifiedNamespace, partitionId}; - UpdateOwnership(blob, o); - ownerships.push_back(o); - } - } - - return ownerships; -} - -/**@brief UpdateCheckpoint updates a specific checkpoint with a sequence and offset. - */ -void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateCheckpoint( - Checkpoint const& checkpoint, - Core::Context const& context) -{ - std::string blobName = checkpoint.GetCheckpointBlobName(); - SetMetadata(blobName, CreateCheckpointBlobMetadata(checkpoint), Azure::ETag(), context); -} - -std::pair -Azure::Messaging::EventHubs::BlobCheckpointStore::SetMetadata( - std::string const& blobName, - Azure::Storage::Metadata const& metadata, - Azure::ETag const& etag, - Core::Context const& context) -{ - auto blobClient = m_containerClient.GetBlockBlobClient(blobName); - std::pair returnValue; - Azure::Storage::Blobs::SetBlobMetadataOptions options; - - try - { - if (etag.HasValue()) - { - options.AccessConditions.IfMatch = etag; - } - - Azure::Storage::Blobs::Models::SetBlobMetadataResult result - = blobClient.SetMetadata(metadata, options, context).Value; - - returnValue = std::make_pair(result.LastModified, result.ETag); - } - catch (Azure::Core::RequestFailedException const& ex) - { - // Ignore HTTP code 412 meaning condition could not be met; - if (ex.StatusCode == Azure::Core::Http::HttpStatusCode::PreconditionFailed) - { - } - if (ex.StatusCode == Azure::Core::Http::HttpStatusCode::NotFound) - { - Azure::Core::Diagnostics::_internal::Log::Write( - Azure::Core::Diagnostics::Logger::Level::Warning, - "Set Metadata failed with PreconditionFailed or NotFound.; Upload blob content"); - - std::string blobContent = ""; - // throws when blob does not exist , we need to upload the blob in order to create it - std::vector buffer(blobContent.begin(), blobContent.end()); - Azure::Storage::Blobs::UploadBlockBlobFromOptions upOptions; - upOptions.Metadata = metadata; - Azure::Storage::Blobs::Models::UploadBlockBlobFromResult result - = blobClient.UploadFrom(buffer.data(), buffer.size(), upOptions, context).Value; - returnValue = std::make_pair(result.LastModified, result.ETag); - } - else - { - throw; - } - } - - return returnValue; -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp index 82af1f7e56..99d5ef26bb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp @@ -2,6 +2,7 @@ // Licensed under the MIT License. #include "eventhubs_test_base.hpp" +#include "test_checkpoint_store.hpp" #include #include @@ -15,7 +16,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { virtual void SetUp() override { EventHubsTestBase::SetUp(); - m_blobClientOptions = InitClientOptions(); +// m_blobClientOptions = InitClientOptions(); } protected: @@ -33,16 +34,14 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { return name; } - Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions; +// Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions; }; TEST_F(CheckpointStoreTest, TestCheckpoints) { std::string const testName = GetRandomName(); std::string consumerGroup = GetEnv("EVENTHUB_CONSUMER_GROUP"); - auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( - GetEnv("CHECKPOINTSTORE_STORAGE_CONNECTION_STRING"), testName, m_blobClientOptions)}; - Azure::Messaging::EventHubs::BlobCheckpointStore checkpointStore(containerClient); + Azure::Messaging::EventHubs::Test::TestCheckpointStore checkpointStore; auto checkpoints = checkpointStore.ListCheckpoints( "fully-qualified-namespace", "event-hub-name", "consumer-group"); @@ -91,10 +90,8 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { TEST_F(CheckpointStoreTest, TestOwnerships) { std::string const testName = GetRandomName(); - auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( - GetEnv("CHECKPOINTSTORE_STORAGE_CONNECTION_STRING"), testName, m_blobClientOptions)}; - Azure::Messaging::EventHubs::BlobCheckpointStore checkpointStore(containerClient); + TestCheckpointStore checkpointStore; auto ownerships = checkpointStore.ListOwnership( "fully-qualified-namespace", "event-hub-name", "consumer-group"); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp index 1f8943b6b9..88e9132396 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "./test_checkpoint_store.hpp" #include @@ -26,11 +27,8 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { TEST_F(ProcessorTest, LoadBalancing_LIVEONLY_) { std::string const testName = GetRandomName(); - auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( - Azure::Core::_internal::Environment::GetVariable( - "CHECKPOINTSTORE_STORAGE_CONNECTION_STRING"), - testName)}; - Azure::Messaging::EventHubs::BlobCheckpointStore checkpointStore(containerClient); + std::shared_ptr checkpointStore{ + std::make_shared()}; std::string eventHubName{GetEnv("EVENTHUB_NAME")}; std::string consumerGroup = GetEnv("EVENTHUB_CONSUMER_GROUP"); @@ -49,10 +47,10 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { Processor processor( std::make_shared(client), - std::make_shared(checkpointStore), + checkpointStore, processorOptions); - processor.Run(); + processor.Run({}); GTEST_LOG_(INFO) << "Sleep for 10 seconds to allow the processor to stabilize."; std::this_thread::sleep_for(std::chrono::seconds(10)); From 1cae340ca73ed671fd5e89a8f599000ff32fa232 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 15:35:16 -0700 Subject: [PATCH 02/37] fixed issue in test cmakelists.txt --- .../test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt index a571aa6d0e..d48262df76 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt @@ -21,7 +21,7 @@ add_executable ( ) create_per_service_target_build(eventhubs azure-messaging-eventhubs-blobcheckpointstore-test) -create_map_file(azure-messaging-eventhubs-test azure-messaging-eventhubs-blobcheckpointstore-test.map) +create_map_file(azure-messaging-eventhubs-blobcheckpointstore-test azure-messaging-eventhubs-blobcheckpointstore-test.map) if (MSVC) target_compile_options(azure-messaging-eventhubs-blobcheckpointstore-test PUBLIC /wd6326 /wd26495 /wd26812) From 38d6cb8a37cab3971c901eb9505397e05a281fd4 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 15:38:24 -0700 Subject: [PATCH 03/37] Renamed blob checkpointstore test to remove CI ambiguity --- .../test/checkpoint_store_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp index 86caf0f8f3..be7f7a854a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp @@ -12,7 +12,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { - class CheckpointStoreTest : public EventHubsTestBase { + class BlobCheckpointStoreTest : public EventHubsTestBase { virtual void SetUp() override { EventHubsTestBase::SetUp(); @@ -37,7 +37,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions; }; - TEST_F(CheckpointStoreTest, TestCheckpoints) + TEST_F(BlobCheckpointStoreTest, TestCheckpoints) { std::string const testName = GetRandomName(); std::string consumerGroup = GetEnv("EVENTHUB_CONSUMER_GROUP"); @@ -89,7 +89,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { EXPECT_EQ(102, checkpoints[0].Offset.Value()); } - TEST_F(CheckpointStoreTest, TestOwnerships) + TEST_F(BlobCheckpointStoreTest, TestOwnerships) { std::string const testName = GetRandomName(); auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( From 0ab19bd1c351d89ac6b59d9e33b7238289840611 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 16:15:32 -0700 Subject: [PATCH 04/37] Updated checkpoint --- sdk/eventhubs/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/assets.json b/sdk/eventhubs/assets.json index 28a533e27d..91124c6f5c 100644 --- a/sdk/eventhubs/assets.json +++ b/sdk/eventhubs/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/eventhubs", - "Tag": "cpp/eventhubs_ea4655bf2e" + "Tag": "cpp/eventhubs_72eef79be1" } From 4f347238a7bc2c4816cd63b1cb80e4837d51d7ef Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 16:41:25 -0700 Subject: [PATCH 05/37] Load gtest from include path not current dir --- .../test/CMakeLists.txt | 2 +- .../test/checkpoint_store_test.cpp | 2 -- .../test/eventhubs_test_base.hpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt index d48262df76..f4e029c3a7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt @@ -30,8 +30,8 @@ endif() target_link_libraries( azure-messaging-eventhubs-blobcheckpointstore-test PRIVATE - azure-messaging-eventhubs azure-messaging-eventhubs-checkpoint-blob + azure-messaging-eventhubs azure-core-test-fw azure-identity gtest diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp index be7f7a854a..2d15438657 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp @@ -8,8 +8,6 @@ #include #include -#include - namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { class BlobCheckpointStoreTest : public EventHubsTestBase { diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp index 5af8ebc896..fceed160ab 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -#include "gtest/gtest.h" +#include #include From 2e35ba49206f250572483e3e4d73431353839daf Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 14 Sep 2023 17:08:47 -0700 Subject: [PATCH 06/37] clang-format; added checkpoint store test --- CMakePresets.json | 26 +++++++++++++++++++ .../CMakeLists.txt | 2 +- .../src/blob_checkpoint_store.cpp | 4 +-- .../src/private/package_version.hpp | 3 ++- .../test/CMakeLists.txt | 2 +- ...est.cpp => blob_checkpoint_store_test.cpp} | 2 +- .../test/eventhubs_test_base.hpp | 4 +-- .../models/checkpoint_store_models.hpp | 2 +- .../azure/messaging/eventhubs/processor.hpp | 2 +- .../src/checkpoint_store.cpp | 1 - .../test/ut/checkpoint_store_test.cpp | 3 --- .../test/ut/processor_test.cpp | 6 ++--- 12 files changed, 39 insertions(+), 18 deletions(-) rename sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/{checkpoint_store_test.cpp => blob_checkpoint_store_test.cpp} (100%) diff --git a/CMakePresets.json b/CMakePresets.json index d24d7fd37e..eb862b079f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -90,6 +90,22 @@ }, "architecture": "win32" }, + { + "name": "x64-msvc-static", + "displayName": "Windows x64 MSVC Static", + "description": "Windows Default, MSVC, x64 architecture.", + "inherits": "msvc-windows-default", + "hidden": true, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-windows-static", + "MSVC_USE_STATIC_CRT": true + }, + "architecture": { + "value": "x64", + "strategy": "external" + } + }, + { "name": "x64", "displayName": "Windows x64", @@ -305,6 +321,16 @@ "displayName": "x86 MSVC Debug static With Perf Tests and samples", "inherits": [ "x86-msvc-static", "debug-build", "enable-tests", "enable-perf", "enable-samples", "curl-transport", "winhttp-transport" ] }, + { + "name": "x64-msvc-static-debug-perftests", + "displayName": "x64 MSVC Debug static With Perf Tests and samples", + "inherits": [ "x64-msvc-static", "debug-build", "enable-tests", "enable-perf", "enable-samples", "curl-transport", "winhttp-transport" ] + }, + { + "name": "x64-msvc-static-release-perftests", + "displayName": "x64 MSVC Release static With Perf Tests and samples", + "inherits": [ "x64-msvc-static", "release-build", "enable-tests", "enable-perf", "enable-samples", "curl-transport", "winhttp-transport" ] + }, { "name": "x64-static-release-perftests", "displayName": "x64 Release With Perf Tests, static", diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt index 00eeb7887e..d33b4f9612 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -84,7 +84,7 @@ target_link_libraries(azure-messaging-eventhubs-checkpoint-blob ) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF -create_code_coverage(azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob "tests?/*;samples?/*") +create_code_coverage(azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-blobcheckpointstore-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp index 9653e06d4c..9468a6d9af 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -#include "azure/messaging/eventhubs/checkpoint_store.hpp" #include "azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp" +#include "azure/messaging/eventhubs/checkpoint_store.hpp" + #include #include using namespace Azure::Messaging::EventHubs::Models; - void Azure::Messaging::EventHubs::BlobCheckpointStore::UpdateCheckpointImpl( Azure::Storage::Metadata const& metadata, Checkpoint& checkpoint) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp index e064948799..2680b357fb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp @@ -16,7 +16,8 @@ #define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_PRERELEASE "beta.1" #define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER(i) #i -#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(i) AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER(i) +#define AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA(i) \ + AZURE_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_VERSION_ITOA_HELPER(i) namespace Azure { namespace Messaging { namespace EventHubs { namespace _detail { /** diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt index f4e029c3a7..29882d82c7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt @@ -17,7 +17,7 @@ SetUpTestProxy("sdk/eventhubs") ################## Unit Tests ########################## add_executable ( azure-messaging-eventhubs-blobcheckpointstore-test - checkpoint_store_test.cpp + blob_checkpoint_store_test.cpp ) create_per_service_target_build(eventhubs azure-messaging-eventhubs-blobcheckpointstore-test) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp index 2d15438657..871aa9f014 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -#include "eventhubs_test_base.hpp" #include "azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp" +#include "eventhubs_test_base.hpp" #include #include diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp index fceed160ab..ad4d0d12ab 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -#include - #include +#include + class EventHubsTestBase : public Azure::Core::Test::TestBase { public: EventHubsTestBase() { TestBase::SetUpTestSuiteLocal(AZURE_TEST_ASSETS_DIR); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp index 202fc6956c..f12a1ff78d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp @@ -3,8 +3,8 @@ #pragma once #include #include -#include #include +#include #include #include diff --git a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp index bd7eeb6e24..b5af59d694 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/processor.hpp @@ -141,7 +141,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { // const auto current = std::chrono::system_clock::from_time_t(timeNowSeconds); //// TODO : this is where we re load balance on the update interval - //while (!context.IsCancelled()) + // while (!context.IsCancelled()) //{ // std::this_thread::sleep_for(m_ownershipUpdateInterval); // Dispatch(eventHubProperties, consumers, context); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp index 9dfe67619e..91f1b78a96 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/checkpoint_store.cpp @@ -56,4 +56,3 @@ std::string Azure::Messaging::EventHubs::Models::Checkpoint::GetCheckpointBlobNa } return GetCheckpointBlobPrefixName() + PartitionId; } - diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp index 99d5ef26bb..2d29354e20 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp @@ -16,7 +16,6 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { virtual void SetUp() override { EventHubsTestBase::SetUp(); -// m_blobClientOptions = InitClientOptions(); } protected: @@ -33,8 +32,6 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { } return name; } - -// Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions; }; TEST_F(CheckpointStoreTest, TestCheckpoints) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp index 88e9132396..bf0aa3c1f4 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/processor_test.cpp @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#include "./test_checkpoint_store.hpp" #include "eventhubs_test_base.hpp" #include #include #include #include -#include "./test_checkpoint_store.hpp" #include @@ -46,9 +46,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { processorOptions.UpdateInterval = std::chrono::seconds(2); Processor processor( - std::make_shared(client), - checkpointStore, - processorOptions); + std::make_shared(client), checkpointStore, processorOptions); processor.Run({}); From 90455ee04a369ab185f7bb23a8045597e1d6a429 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 09:38:54 -0700 Subject: [PATCH 07/37] shortened the name of checkpoint store test --- .../test/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt index 29882d82c7..47e0dd046f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.13) -project (azure-messaging-eventhubs-blobcheckpointstore-test LANGUAGES CXX) +project (azure-messaging-eventhubs-blobstore-test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -16,38 +16,38 @@ SetUpTestProxy("sdk/eventhubs") ################## Unit Tests ########################## add_executable ( - azure-messaging-eventhubs-blobcheckpointstore-test + azure-messaging-eventhubs-blobstore-test blob_checkpoint_store_test.cpp ) -create_per_service_target_build(eventhubs azure-messaging-eventhubs-blobcheckpointstore-test) -create_map_file(azure-messaging-eventhubs-blobcheckpointstore-test azure-messaging-eventhubs-blobcheckpointstore-test.map) +create_per_service_target_build(eventhubs azure-messaging-eventhubs-blobstore-test) +create_map_file(azure-messaging-eventhubs-blobstore-test azure-messaging-eventhubs-blobstore-test.map) if (MSVC) - target_compile_options(azure-messaging-eventhubs-blobcheckpointstore-test PUBLIC /wd6326 /wd26495 /wd26812) + target_compile_options(azure-messaging-eventhubs-blobstore-test PUBLIC /wd6326 /wd26495 /wd26812) endif() target_link_libraries( - azure-messaging-eventhubs-blobcheckpointstore-test + azure-messaging-eventhubs-blobstore-test PRIVATE azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs azure-core-test-fw azure-identity gtest - gtest_main + gtest_main gmock ) # Adding private headers so we can test the private APIs with no relative paths include. target_include_directories ( - azure-messaging-eventhubs-blobcheckpointstore-test + azure-messaging-eventhubs-blobstore-test PRIVATE $) # gtest_add_tests will scan the test from azure-messaging-eventhubs-test and call add_test # for each test to ctest. This enables `ctest -r` to run specific tests directly. -gtest_discover_tests(azure-messaging-eventhubs-blobcheckpointstore-test +gtest_discover_tests(azure-messaging-eventhubs-blobstore-test TEST_PREFIX azure-messaging-eventhubs. NO_PRETTY_TYPES NO_PRETTY_VALUES From b3f233b8aad9d3f15881020edbb264e94f414fd2 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 10:19:16 -0700 Subject: [PATCH 08/37] SShortened name of blob checkpoint package location --- sdk/eventhubs/CMakeLists.txt | 2 +- .../CMakeLists.txt | 0 .../eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp | 0 .../eventhubs/checkpointstore_blob/dll_import_export.hpp | 0 .../inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp | 0 .../src/blob_checkpoint_store.cpp | 0 .../src/private/package_version.hpp | 0 .../test/CMakeLists.txt | 0 .../test/blob_checkpoint_store_test.cpp | 0 .../test/eventhubs_test_base.hpp | 0 .../vcpkg/Config.cmake.in | 0 .../vcpkg/portfile.cmake | 0 .../vcpkg/vcpkg.json | 0 13 files changed, 1 insertion(+), 1 deletion(-) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/src/blob_checkpoint_store.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/src/private/package_version.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/test/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/test/blob_checkpoint_store_test.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/test/eventhubs_test_base.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/vcpkg/Config.cmake.in (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/vcpkg/portfile.cmake (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => azure-messaging-eventhubs-blobcheckpoints}/vcpkg/vcpkg.json (100%) diff --git a/sdk/eventhubs/CMakeLists.txt b/sdk/eventhubs/CMakeLists.txt index ab59299748..164af057ec 100644 --- a/sdk/eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/CMakeLists.txt @@ -9,4 +9,4 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_subdirectory(azure-messaging-eventhubs) -add_subdirectory(azure-messaging-eventhubs-checkpointstore-blob) +add_subdirectory(azure-messaging-eventhubs-blobcheckpoints) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/blob_checkpoint_store.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/blob_checkpoint_store.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/private/package_version.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/private/package_version.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/blob_checkpoint_store_test.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/blob_checkpoint_store_test.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/eventhubs_test_base.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/eventhubs_test_base.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/Config.cmake.in similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/Config.cmake.in diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/portfile.cmake similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/portfile.cmake diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/vcpkg.json similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json rename to sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/vcpkg.json From f0ef8ac9ebba6555fe67c420e9c0f1cb1a69ba52 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 10:33:42 -0700 Subject: [PATCH 09/37] Moved name of blob checkpoint package location back --- sdk/eventhubs/CMakeLists.txt | 2 +- .../CMakeLists.txt | 0 .../eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp | 0 .../eventhubs/checkpointstore_blob/dll_import_export.hpp | 0 .../inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp | 0 .../src/blob_checkpoint_store.cpp | 0 .../src/private/package_version.hpp | 0 .../test/CMakeLists.txt | 0 .../test/blob_checkpoint_store_test.cpp | 0 .../test/eventhubs_test_base.hpp | 0 .../vcpkg/Config.cmake.in | 0 .../vcpkg/portfile.cmake | 0 .../vcpkg/vcpkg.json | 0 13 files changed, 1 insertion(+), 1 deletion(-) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/src/blob_checkpoint_store.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/src/private/package_version.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/test/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/test/blob_checkpoint_store_test.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/test/eventhubs_test_base.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/vcpkg/Config.cmake.in (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/vcpkg/portfile.cmake (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-blobcheckpoints => azure-messaging-eventhubs-checkpointstore-blob}/vcpkg/vcpkg.json (100%) diff --git a/sdk/eventhubs/CMakeLists.txt b/sdk/eventhubs/CMakeLists.txt index 164af057ec..ab59299748 100644 --- a/sdk/eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/CMakeLists.txt @@ -9,4 +9,4 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_subdirectory(azure-messaging-eventhubs) -add_subdirectory(azure-messaging-eventhubs-blobcheckpoints) +add_subdirectory(azure-messaging-eventhubs-checkpointstore-blob) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/CMakeLists.txt rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/blob_checkpoint_store.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/blob_checkpoint_store.cpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/private/package_version.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/src/private/package_version.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/CMakeLists.txt rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/blob_checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/blob_checkpoint_store_test.cpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/eventhubs_test_base.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/test/eventhubs_test_base.hpp rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/Config.cmake.in b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/Config.cmake.in rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/portfile.cmake b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/portfile.cmake rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake diff --git a/sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-blobcheckpoints/vcpkg/vcpkg.json rename to sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json From 91f69da67b80b21f951d055e06e9296d3a3ad25b Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 11:13:42 -0700 Subject: [PATCH 10/37] Only include tests when building tests --- .../CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt index d33b4f9612..44d6199d72 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -89,7 +89,9 @@ create_code_coverage(azure-messaging-eventhubs-checkpoint-blob azure-messaging-e get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) -add_subdirectory(test) +if(BUILD_TESTING) + add_subdirectory(test) +endif() az_vcpkg_export( azure-messaging-eventhubs-checkpoint-blob From 0fe2c284d4ad43c87aca3e8184b2081212a170c5 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 11:27:19 -0700 Subject: [PATCH 11/37] Hook checkpoitn store blobs to eventhubs correctly --- .../CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt index 44d6199d72..fe1f4fa6f3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -84,7 +84,7 @@ target_link_libraries(azure-messaging-eventhubs-checkpoint-blob ) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF -create_code_coverage(azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-blobcheckpointstore-test "tests?/*;samples?/*") +create_code_coverage(eventhubs azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-blobcheckpointstore-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) From b6cf1b3cf9abc08705159c498950f65adaad31d3 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 11:28:00 -0700 Subject: [PATCH 12/37] clang-format --- .../test/ut/checkpoint_store_test.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp index 2d29354e20..eef4683a97 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/checkpoint_store_test.cpp @@ -13,10 +13,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test { class CheckpointStoreTest : public EventHubsTestBase { - virtual void SetUp() override - { - EventHubsTestBase::SetUp(); - } + virtual void SetUp() override { EventHubsTestBase::SetUp(); } protected: std::string GetRandomName() From 73e7648956a072db61e598b81679ebad76168253 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 13:05:37 -0700 Subject: [PATCH 13/37] Some live tests don't need to be live only --- .../test/ut/producer_client_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/producer_client_test.cpp b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/producer_client_test.cpp index 13a751e0cb..45a996e25f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/test/ut/producer_client_test.cpp +++ b/sdk/eventhubs/azure-messaging-eventhubs/test/ut/producer_client_test.cpp @@ -16,7 +16,7 @@ class ProducerClientTest : public EventHubsTestBase { }; -TEST_F(ProducerClientTest, ConnectionStringNoEntityPath_LIVEONLY_) +TEST_F(ProducerClientTest, ConnectionStringNoEntityPath) { std::string const connStringNoEntityPath = GetEnv("EVENTHUB_CONNECTION_STRING"); std::string eventHubName{GetEnv("EVENTHUB_NAME")}; @@ -25,7 +25,7 @@ TEST_F(ProducerClientTest, ConnectionStringNoEntityPath_LIVEONLY_) EXPECT_EQ(eventHubName, client.GetEventHubName()); } -TEST_F(ProducerClientTest, ConnectionStringEntityPath_LIVEONLY_) +TEST_F(ProducerClientTest, ConnectionStringEntityPath) { std::string eventHubName{GetEnv("EVENTHUB_NAME")}; std::string const connStringEntityPath From ae96e7f3c0e542acf4f47bb13170df9a4f2aabd0 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 14:01:22 -0700 Subject: [PATCH 14/37] Added readme and changelog for checkpoint store; removed more storage dependencies --- .../CHANGELOG.md | 13 +++ .../LICENSE | 21 +++++ .../README.md | 80 +++++++++++++++++++ .../vcpkg/portfile.cmake | 2 +- .../vcpkg/vcpkg.json | 2 +- .../vcpkg/Config.cmake.in | 1 - .../vcpkg/vcpkg.json | 5 -- 7 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md new file mode 100644 index 0000000000..48e8147d08 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -0,0 +1,13 @@ +# Release History + +## 1.0.0-beta.3 (Unreleased) + +### Features Added + +- Initial release. Split from azure-messaging-eventubs package + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE new file mode 100644 index 0000000000..96a394c43c --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md new file mode 100644 index 0000000000..9a637c5fa7 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -0,0 +1,80 @@ + +# Azure Event Hubs Blob Storage Checkpoint Store for C++ + +The EventHubs Blob Storage Checkpoint Store is a checkpoint store for the +[Azure Event Hubs](https://azure.microsoft.com/services/event-hubs/) service, used to enable an +[Event Processor](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host) to store checkpoints and partition ownership information in Azure Blob Storage. + +For information on how to use an EventHubs processor, see the [Azure SDK for C++ EventHubs documentation](https://azure.github.io/azure-sdk-for-cpp/eventhubs.html). + +Key links: +- [Source code][source] +- [API Reference Documentation][cppdoc] +- [Product documentation](https://azure.microsoft.com/services/event-hubs/) +- [Samples][cppdoc_examples] + +## Getting started + +### Install the package + +Install the Azure Event Hubs Blob Storage Checkpoint Store for C++ with `vcpkg`: + +```bash +vcpkg install azure-messaging-eventhubs-checkpointstore-blob-cpp +``` + +### Prerequisites + +- A C++ Compiler with C++14 support +- An [Azure subscription](https://azure.microsoft.com/free/) +- An [Event Hub namespace](https://docs.microsoft.com/azure/event-hubs/). +- An Event Hub. You can create an event hub in your Event Hubs Namespace using the [Azure Portal](https://docs.microsoft.com/azure/event-hubs/event-hubs-create), or the [Azure CLI](https://docs.microsoft.com/azure/event-hubs/event-hubs-quickstart-cli). + +## Contributing +For details on contributing to this repository, see the [contributing guide][azure_sdk_for_cpp_contributing]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +### Additional Helpful Links for Contributors +Many people all over the world have helped make this project better. You'll want to check out: + +* [What are some good first issues for new contributors to the repo?](https://github.com/azure/azure-sdk-for-cpp/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22) +* [How to build and test your change][azure_sdk_for_cpp_contributing_developer_guide] +* [How you can make a change happen!][azure_sdk_for_cpp_contributing_pull_requests] +* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for C++ wiki](https://github.com/azure/azure-sdk-for-cpp/wiki). + + +### Reporting security issues and security bugs + +Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) . You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). + +### License + +Azure SDK for C++ is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-cpp/blob/main/LICENSE.txt) license. + + +[azure_sdk_for_cpp_contributing]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md +[azure_sdk_for_cpp_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md#developer-guide +[azure_sdk_for_cpp_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md#pull-requests + +[consumer_client]: https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-messaging-eventhubs/latest/class_azure_1_1_messaging_1_1_event_hubs_1_1_consumer_client.html +[producer_client]: https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-messaging-eventhubs/1.0.0-beta.1/class_azure_1_1_messaging_1_1_event_hubs_1_1_producer_client.html + +[source]: https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/eventhubs +[azure_identity_pkg]: https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-identity/latest/index.html +[default_azure_credential]: https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-identity/latest/index.html#defaultazurecredential + +[cppdoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs +[cppdoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#pkg-examples + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-cpp%2Fsdk%2Feventhubs%2FREADME.png) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake index 013cf22caf..bbee285d09 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake @@ -9,7 +9,7 @@ vcpkg_from_github( ) vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}/sdk/eventhubs/azure-messaging-eventhubs/" + SOURCE_PATH "${SOURCE_PATH}/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/" OPTIONS -DWARNINGS_AS_ERRORS=OFF -DBUILD_TESTING=OFF diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json index 68420a6749..5714916eab 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json @@ -8,7 +8,7 @@ "Microsoft Azure Messaging Event Hubs SDK for C++ Blob Checkpoint Store", "This library provides an Azure-Storage-Blobs based implementation of an Azure Messaging Event Hubs SDK Checkpoint Store." ], - "homepage": "https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/eventhubs/azure-messaging-eventhubs", + "homepage": "https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob", "license": "MIT", "dependencies": [ { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/Config.cmake.in b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/Config.cmake.in index 74952aaac8..b5fc85006f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/Config.cmake.in +++ b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/Config.cmake.in @@ -5,7 +5,6 @@ include(CMakeFindDependencyMacro) find_dependency(azure-core-amqp-cpp) -find_dependency(azure-storage-blobs-cpp) include("${CMAKE_CURRENT_LIST_DIR}/azure-messaging-eventhubs-cppTargets.cmake") diff --git a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/vcpkg.json index bf343f03e5..73a7a1096a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/vcpkg.json +++ b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg/vcpkg.json @@ -16,11 +16,6 @@ "default-features": false, "version>=": "1.0.0-beta.2" }, - { - "name": "azure-storage-blobs-cpp", - "default-features": false, - "version>=": "12.8.0" - }, { "name": "vcpkg-cmake", "host": true From 0b6e929386162d9c8cbc22447f89c53ac3fc8770 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 14:16:50 -0700 Subject: [PATCH 15/37] Fixed link --- .../azure-messaging-eventhubs-checkpointstore-blob/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md index 9a637c5fa7..67f3c3c973 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -3,7 +3,7 @@ The EventHubs Blob Storage Checkpoint Store is a checkpoint store for the [Azure Event Hubs](https://azure.microsoft.com/services/event-hubs/) service, used to enable an -[Event Processor](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host) to store checkpoints and partition ownership information in Azure Blob Storage. +[Event Processor](https://learn.microsoft.com/azure/event-hubs/event-hubs-event-processor-host) to store checkpoints and partition ownership information in Azure Blob Storage. For information on how to use an EventHubs processor, see the [Azure SDK for C++ EventHubs documentation](https://azure.github.io/azure-sdk-for-cpp/eventhubs.html). From 899031853270581334cb514e4d4be298d6219107 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 15 Sep 2023 16:42:47 -0700 Subject: [PATCH 16/37] Update sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> --- .../azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md index 48e8147d08..cca7cabcbc 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -4,7 +4,7 @@ ### Features Added -- Initial release. Split from azure-messaging-eventubs package +- Initial release. Split from the `azure-messaging-eventubs` package. ### Breaking Changes From 3d7253d45faa564fc1c7864cea2a5359beb03f6e Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 12:13:06 -0700 Subject: [PATCH 17/37] FolderList.cmake updates for blob storage --- cmake-modules/FolderList.cmake | 4 ++++ .../CMakeLists.txt | 2 +- sdk/eventhubs/ci.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake-modules/FolderList.cmake b/cmake-modules/FolderList.cmake index 7a2177246c..bb47e2481e 100644 --- a/cmake-modules/FolderList.cmake +++ b/cmake-modules/FolderList.cmake @@ -33,6 +33,10 @@ macro(GetFolderList project) elseif(${project} STREQUAL EVENTHUBS) DownloadDepVersion(sdk/core azure-core 1.10.1) DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) + elseif(${project} STREQUAL EVENTHUBS_CHECKPOINT_BLOB) + DownloadDepVersion(sdk/core azure-core 1.10.1) + DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) + DownloadDepVersion(sdk/eventhubs azure-messaging-eventhubs 1.0.0-beta.3) DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.3) DownloadDepVersion(sdk/storage/azure-storage-blobs azure-storage-blobs 12.8.0) endif() diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt index fe1f4fa6f3..a25ea8b705 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if(FETCH_SOURCE_DEPS) set(AZ_ALL_LIBRARIES ON) include(FolderList) - SetCompileOptions(EVENTHUBS) + SetCompileOptions(EVENTHUBS_CHECKPOINT_BLOB) endif() include(AzureVersion) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index b5343f0d96..dc1a0f6509 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -69,4 +69,4 @@ stages: Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON' CMakeSourceTestOptions: - Name: Source - Value: '-DFETCH_SOURCE_DEPS=OFF' + Value: '-DFETCH_SOURCE_DEPS=ON' From 03285b22f64eda4d4581b05419c6bcaa97f39ae2 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 12:54:55 -0700 Subject: [PATCH 18/37] fixed dllimport_export.hpp #define values --- .../dll_import_export.hpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp index d82dff41e2..cfedc91df3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp @@ -11,29 +11,30 @@ #pragma once /** - * @def AZ_MESSAGING_EVENTHUBS_DLLEXPORT + * @def AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLLEXPORT * @brief Applies DLL export attribute, when applicable. * @note See https://docs.microsoft.com/cpp/cpp/dllexport-dllimport?view=msvc-160. */ -#if defined(AZ_MESSAGING_EVENTHUBS_DLL) || (0 /*@AZ_MESSAGING_EVENTHUBS_DLL_INSTALLED_AS_PACKAGE@*/) -#define AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL 1 +#if defined(AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLL) \ + || (0 /*@AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLL_INSTALLED_AS_PACKAGE@*/) +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL 1 #else -#define AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL 0 +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL 0 #endif -#if AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL +#if AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL #if defined(_MSC_VER) -#if defined(AZ_MESSAGING_EVENTHUBS_BEING_BUILT) -#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT __declspec(dllexport) -#else // !defined(AZ_MESSAGING_EVENTHUBS_BEING_BUILT) -#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT __declspec(dllimport) -#endif // AZ_MESSAGING_EVENTHUBS_BEING_BUILT +#if defined(AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BEING_BUILT) +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLLEXPORT __declspec(dllexport) +#else // !defined(AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BEING_BUILT) +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLLEXPORT __declspec(dllimport) +#endif // AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BEING_BUILT #else // !defined(_MSC_VER) -#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLLEXPORT #endif // _MSC_VER -#else // !AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL -#define AZ_MESSAGING_EVENTHUBS_DLLEXPORT -#endif // AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL +#else // !AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL +#define AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_DLLEXPORT +#endif // AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL -#undef AZ_MESSAGING_EVENTHUBS_BUILT_AS_DLL +#undef AZ_MESSAGING_EVENTHUBS_CHECKPOINTSTORE_BLOB_BUILT_AS_DLL From 1d45e47045e0ee097e6c33a458441dabdb89a4f4 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 13:16:00 -0700 Subject: [PATCH 19/37] CI tweaks --- .../azure-core-tracing-opentelemetry/CMakeLists.txt | 12 +++++++++++- sdk/eventhubs/ci.yml | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index 09dadbbde2..44e592f12a 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -11,7 +11,17 @@ cmake_minimum_required (VERSION 3.12) project(azure-core-tracing-opentelemetry LANGUAGES CXX) if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows" OR VCPKG_TARGET_TRIPLET MATCHES "static" OR NOT WIN32) - set(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY ON) + if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows") + message(STATUS "azure-core-tracing-opentelemetry is not on windows.") + endif() + if (VCPKG_TARGET_TRIPLET matches "static") + message(STATUS "azure-core-tracing-opentelemetry is static build.") + endif() + if (NOT WIN32) + message(STATUS "azure-core-tracing-opentelemetry is not on windows.") + endif() + message(STATUS "azure-core-tracing-opentelemetry enabled.") + set(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY ON) endif() set(CMAKE_CXX_STANDARD 14) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index dc1a0f6509..c1a32fac22 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -36,10 +36,16 @@ stages: - Name: azure-messaging-eventhubs Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp + - Name: azure-messaging-eventhubs-checkpointstore-blob + Path: azure-messaging-eventhubs-checkpointstore-blob + VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp ArtifactsSource: - Name: azure-messaging-eventhubs Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp + - Name: azure-messaging-eventhubs-checkpointstore-blob + Path: azure-messaging-eventhubs-checkpointstore-blob + VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp TestEnv: - Name: AZURE_TENANT_ID Value: "33333333-3333-3333-3333-333333333333" From c1a30af59af07e47a556bc79dbae28fc9dea4681 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 13:23:56 -0700 Subject: [PATCH 20/37] diagnostics for otel failure --- .../CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index 44e592f12a..14aa428d5f 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -10,16 +10,16 @@ az_vcpkg_integrate() cmake_minimum_required (VERSION 3.12) project(azure-core-tracing-opentelemetry LANGUAGES CXX) +if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows") + message(STATUS "azure-core-tracing-opentelemetry is not on windows.") +endif() +if (VCPKG_TARGET_TRIPLET matches "static") + message(STATUS "azure-core-tracing-opentelemetry is static build.") +endif() +if (NOT WIN32) + message(STATUS "azure-core-tracing-opentelemetry is not on windows.") +endif() if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows" OR VCPKG_TARGET_TRIPLET MATCHES "static" OR NOT WIN32) - if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows") - message(STATUS "azure-core-tracing-opentelemetry is not on windows.") - endif() - if (VCPKG_TARGET_TRIPLET matches "static") - message(STATUS "azure-core-tracing-opentelemetry is static build.") - endif() - if (NOT WIN32) - message(STATUS "azure-core-tracing-opentelemetry is not on windows.") - endif() message(STATUS "azure-core-tracing-opentelemetry enabled.") set(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY ON) endif() From b416f816386c807bedd1df90d24108e7ecb0b1e7 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 13:41:12 -0700 Subject: [PATCH 21/37] more fetch_sources_deps fixes --- sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt | 9 +++++++++ sdk/eventhubs/ci.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index 14aa428d5f..fa3ac04c9a 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -10,6 +10,15 @@ az_vcpkg_integrate() cmake_minimum_required (VERSION 3.12) project(azure-core-tracing-opentelemetry LANGUAGES CXX) +message(STATUS "Azure core tracing opentelemetry CMake version: ${CMAKE_VERSION}") +message(STATUS "Azure core tracing opentelemetry CMake system name: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Azure core tracing opentelemetry CMake project name: ${PROJECT_NAME}") +message(STATUS "Azure core tracing opentelemetry CMake project source dir: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "Azure core tracing opentelemetry CMake CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}") +message(STATUS "Azure core tracing opentelemetry CMake VCPKG_TARGET_TRIPLET: ${VCPKG_TARGET_TRIPLET}") +message(STATUS "Azure core tracing opentelemetry CMake CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") +message(STATUS "Azure core tracing opentelemetry CMake WIN32: ${WIN32}") + if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows") message(STATUS "azure-core-tracing-opentelemetry is not on windows.") endif() diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index c1a32fac22..65a77773dc 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -75,4 +75,4 @@ stages: Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON' CMakeSourceTestOptions: - Name: Source - Value: '-DFETCH_SOURCE_DEPS=ON' + Value: '-DFETCH_SOURCE_DEPS=LATEST' From 37cede1c5f9f08eef09d5d184aa26f100284522a Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 14:22:06 -0700 Subject: [PATCH 22/37] updated dependencies for eventhubs --- .../vcpkg.json | 8 ++++++++ sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json | 1 + 2 files changed, 9 insertions(+) create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json new file mode 100644 index 0000000000..ba82fb06f6 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "azure-messaging-eventhubs-checkpointstore-cpp", + "version-string": "1.0.0", + "dependencies": [ + "azure-messaging-eventhubs-cpp", + "azure-storage-blobs-cpp" + ] +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json index 12ec4a9ee2..9e0b0ed923 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json +++ b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json @@ -2,6 +2,7 @@ "name": "azure-messaging-eventhubs", "version-string": "1.0.0", "dependencies": [ + "azure-core-cpp", "azure-core-amqp-cpp", "azure-storage-blobs-cpp" ] From 6273305e0a906ebc7126d9aa6a98ec52063b5bac Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 14:28:20 -0700 Subject: [PATCH 23/37] EH and blob checkpoint depend on identity --- cmake-modules/FolderList.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake-modules/FolderList.cmake b/cmake-modules/FolderList.cmake index bb47e2481e..1740f73378 100644 --- a/cmake-modules/FolderList.cmake +++ b/cmake-modules/FolderList.cmake @@ -32,9 +32,11 @@ macro(GetFolderList project) DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.4.0) elseif(${project} STREQUAL EVENTHUBS) DownloadDepVersion(sdk/core azure-core 1.10.1) + DownloadDepVersion(sdk/identity azure-identity 1.1.0) DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) elseif(${project} STREQUAL EVENTHUBS_CHECKPOINT_BLOB) DownloadDepVersion(sdk/core azure-core 1.10.1) + DownloadDepVersion(sdk/identity azure-identity 1.1.0) DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) DownloadDepVersion(sdk/eventhubs azure-messaging-eventhubs 1.0.0-beta.3) DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.3) From b200f567e49b357beec12ebdb3123d79a7dde6d7 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 15:04:39 -0700 Subject: [PATCH 24/37] eh core doesn't need storage dependency --- sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json index 9e0b0ed923..a414170534 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json +++ b/sdk/eventhubs/azure-messaging-eventhubs/vcpkg.json @@ -3,7 +3,6 @@ "version-string": "1.0.0", "dependencies": [ "azure-core-cpp", - "azure-core-amqp-cpp", - "azure-storage-blobs-cpp" + "azure-core-amqp-cpp" ] } From 40c2bf7ebc6297a47f946d1c43ca3135dfd0010a Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 15:44:55 -0700 Subject: [PATCH 25/37] Removed identity dependency for eventhubs; disable otel for eventhubs CI builds because EH doesn't depend on otel. --- cmake-modules/FolderList.cmake | 2 -- sdk/eventhubs/ci.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake-modules/FolderList.cmake b/cmake-modules/FolderList.cmake index 1740f73378..bb47e2481e 100644 --- a/cmake-modules/FolderList.cmake +++ b/cmake-modules/FolderList.cmake @@ -32,11 +32,9 @@ macro(GetFolderList project) DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.4.0) elseif(${project} STREQUAL EVENTHUBS) DownloadDepVersion(sdk/core azure-core 1.10.1) - DownloadDepVersion(sdk/identity azure-identity 1.1.0) DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) elseif(${project} STREQUAL EVENTHUBS_CHECKPOINT_BLOB) DownloadDepVersion(sdk/core azure-core 1.10.1) - DownloadDepVersion(sdk/identity azure-identity 1.1.0) DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1) DownloadDepVersion(sdk/eventhubs azure-messaging-eventhubs 1.0.0-beta.3) DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.3) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 65a77773dc..53de57aabc 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -75,4 +75,4 @@ stages: Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON' CMakeSourceTestOptions: - Name: Source - Value: '-DFETCH_SOURCE_DEPS=LATEST' + Value: '-DFETCH_SOURCE_DEPS=LATEST -DDISABLE_AZURE_CORE_OPENTELEMETRY' From bd4d6eb68a0ea1fb7b4491fd16f5eb12c925189e Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 16:00:36 -0700 Subject: [PATCH 26/37] Disable FETCH_SOURCE_DEPS until azure SDK baseline is updated --- sdk/eventhubs/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 53de57aabc..d30c652d8d 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -75,4 +75,7 @@ stages: Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON' CMakeSourceTestOptions: - Name: Source - Value: '-DFETCH_SOURCE_DEPS=LATEST -DDISABLE_AZURE_CORE_OPENTELEMETRY' + # FETCH_SOURCE_DEPS is disabled because azure-messaging-eventhubs is not present in the vcpkg catalog at the current Azure SDK baseline commit. + # Disabling DISABLE_AZURE_CORE_OPENTELEMETRY because eventhubs does not have a dependency on azure-core-opentelemetry, but azure core includes + # azure-core-opentelemetry in builds unless disabled. + Value: '-DFETCH_SOURCE_DEPS=OFF -DDISABLE_AZURE_CORE_OPENTELEMETRY' From 245f355a1e56b2405fc3907a75840bbfc160a9bd Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 16:17:55 -0700 Subject: [PATCH 27/37] removed eventhubs from checkpointstore vcpkg.json --- .../azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json index ba82fb06f6..2b82d529ec 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json @@ -2,7 +2,8 @@ "name": "azure-messaging-eventhubs-checkpointstore-cpp", "version-string": "1.0.0", "dependencies": [ - "azure-messaging-eventhubs-cpp", + "azure-core-cpp", + "azure-core-amqp-cpp", "azure-storage-blobs-cpp" ] } From 6b9d203b28a9dc43faddc23dad025ae298691e0d Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 18 Sep 2023 16:33:06 -0700 Subject: [PATCH 28/37] noise reduction - removed debugging stuff --- .../CMakeLists.txt | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index fa3ac04c9a..42dd2b8bba 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -10,29 +10,6 @@ az_vcpkg_integrate() cmake_minimum_required (VERSION 3.12) project(azure-core-tracing-opentelemetry LANGUAGES CXX) -message(STATUS "Azure core tracing opentelemetry CMake version: ${CMAKE_VERSION}") -message(STATUS "Azure core tracing opentelemetry CMake system name: ${CMAKE_SYSTEM_NAME}") -message(STATUS "Azure core tracing opentelemetry CMake project name: ${PROJECT_NAME}") -message(STATUS "Azure core tracing opentelemetry CMake project source dir: ${CMAKE_CURRENT_SOURCE_DIR}") -message(STATUS "Azure core tracing opentelemetry CMake CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}") -message(STATUS "Azure core tracing opentelemetry CMake VCPKG_TARGET_TRIPLET: ${VCPKG_TARGET_TRIPLET}") -message(STATUS "Azure core tracing opentelemetry CMake CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -message(STATUS "Azure core tracing opentelemetry CMake WIN32: ${WIN32}") - -if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows") - message(STATUS "azure-core-tracing-opentelemetry is not on windows.") -endif() -if (VCPKG_TARGET_TRIPLET matches "static") - message(STATUS "azure-core-tracing-opentelemetry is static build.") -endif() -if (NOT WIN32) - message(STATUS "azure-core-tracing-opentelemetry is not on windows.") -endif() -if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows" OR VCPKG_TARGET_TRIPLET MATCHES "static" OR NOT WIN32) - message(STATUS "azure-core-tracing-opentelemetry enabled.") - set(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY ON) -endif() - set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) From e3b66d23ecc522521aac0a3b802e1d8621c99f74 Mon Sep 17 00:00:00 2001 From: "Larry Osterman (from Dev Box)" Date: Tue, 19 Sep 2023 12:54:35 -0700 Subject: [PATCH 29/37] Reset vcpkg checkpoint to a commit including eventhubs --- cmake-modules/AzureVcpkg.cmake | 3 ++- .../CHANGELOG.md | 0 .../CMakeLists.txt | 0 .../LICENSE | 0 .../README.md | 0 .../eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp | 0 .../eventhubs/checkpointstore_blob/dll_import_export.hpp | 0 .../azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp | 0 .../src/blob_checkpoint_store.cpp | 0 .../src/private/package_version.hpp | 0 .../test/CMakeLists.txt | 0 .../test/blob_checkpoint_store_test.cpp | 0 .../test/eventhubs_test_base.hpp | 0 .../vcpkg.json | 1 + .../vcpkg/Config.cmake.in | 0 .../vcpkg/portfile.cmake | 0 .../vcpkg/vcpkg.json | 0 vcpkg.json | 2 +- 18 files changed, 4 insertions(+), 2 deletions(-) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/CHANGELOG.md (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/LICENSE (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/README.md (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/src/blob_checkpoint_store.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/src/private/package_version.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/test/CMakeLists.txt (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/test/blob_checkpoint_store_test.cpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/test/eventhubs_test_base.hpp (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/vcpkg.json (84%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/vcpkg/Config.cmake.in (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/vcpkg/portfile.cmake (100%) rename sdk/eventhubs/{azure-messaging-eventhubs-checkpointstore-blob => blob-store}/vcpkg/vcpkg.json (100%) diff --git a/cmake-modules/AzureVcpkg.cmake b/cmake-modules/AzureVcpkg.cmake index c9d6f1b4c2..e5422c8234 100644 --- a/cmake-modules/AzureVcpkg.cmake +++ b/cmake-modules/AzureVcpkg.cmake @@ -6,6 +6,7 @@ set(AZ_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/..") macro(az_vcpkg_integrate) message("Vcpkg integrate step.") + # AUTO CMAKE_TOOLCHAIN_FILE: # User can call `cmake -DCMAKE_TOOLCHAIN_FILE="path_to_the_toolchain"` as the most specific scenario. # As the last alternative (default case), Azure SDK will automatically clone VCPKG folder and set toolchain from there. @@ -17,7 +18,7 @@ macro(az_vcpkg_integrate) message("AZURE_SDK_DISABLE_AUTO_VCPKG is not defined. Fetch a local copy of vcpkg.") # GET VCPKG FROM SOURCE # User can set env var AZURE_SDK_VCPKG_COMMIT to pick the VCPKG commit to fetch - set(VCPKG_COMMIT_STRING dafef74af53669ef1cc9015f55e0ce809ead62aa) # default SDK tested commit + set(VCPKG_COMMIT_STRING 33409307f1e3411112a0a6bbf3011ea3cca1bfc9) # default SDK tested commit if(DEFINED ENV{AZURE_SDK_VCPKG_COMMIT}) message("AZURE_SDK_VCPKG_COMMIT is defined. Using that instead of the default.") set(VCPKG_COMMIT_STRING "$ENV{AZURE_SDK_VCPKG_COMMIT}") # default SDK tested commit diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/blob-store/CHANGELOG.md similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md rename to sdk/eventhubs/blob-store/CHANGELOG.md diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/blob-store/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt rename to sdk/eventhubs/blob-store/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE b/sdk/eventhubs/blob-store/LICENSE similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/LICENSE rename to sdk/eventhubs/blob-store/LICENSE diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/blob-store/README.md similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md rename to sdk/eventhubs/blob-store/README.md diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp b/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp rename to sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp b/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp rename to sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/dll_import_export.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp b/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp rename to sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/rtti.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp b/sdk/eventhubs/blob-store/src/blob_checkpoint_store.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp rename to sdk/eventhubs/blob-store/src/blob_checkpoint_store.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp b/sdk/eventhubs/blob-store/src/private/package_version.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/private/package_version.hpp rename to sdk/eventhubs/blob-store/src/private/package_version.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt b/sdk/eventhubs/blob-store/test/CMakeLists.txt similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/CMakeLists.txt rename to sdk/eventhubs/blob-store/test/CMakeLists.txt diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp b/sdk/eventhubs/blob-store/test/blob_checkpoint_store_test.cpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/blob_checkpoint_store_test.cpp rename to sdk/eventhubs/blob-store/test/blob_checkpoint_store_test.cpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp b/sdk/eventhubs/blob-store/test/eventhubs_test_base.hpp similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/eventhubs_test_base.hpp rename to sdk/eventhubs/blob-store/test/eventhubs_test_base.hpp diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json b/sdk/eventhubs/blob-store/vcpkg.json similarity index 84% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json rename to sdk/eventhubs/blob-store/vcpkg.json index 2b82d529ec..45557cfdc5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg.json +++ b/sdk/eventhubs/blob-store/vcpkg.json @@ -4,6 +4,7 @@ "dependencies": [ "azure-core-cpp", "azure-core-amqp-cpp", + "azure-messaging-eventhubs-cpp", "azure-storage-blobs-cpp" ] } diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in b/sdk/eventhubs/blob-store/vcpkg/Config.cmake.in similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/Config.cmake.in rename to sdk/eventhubs/blob-store/vcpkg/Config.cmake.in diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake b/sdk/eventhubs/blob-store/vcpkg/portfile.cmake similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/portfile.cmake rename to sdk/eventhubs/blob-store/vcpkg/portfile.cmake diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json b/sdk/eventhubs/blob-store/vcpkg/vcpkg.json similarity index 100% rename from sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/vcpkg/vcpkg.json rename to sdk/eventhubs/blob-store/vcpkg/vcpkg.json diff --git a/vcpkg.json b/vcpkg.json index 23cfc028df..77b190dae6 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "name": "azure-sdk-for-cpp", "version": "1.5.0", - "builtin-baseline": "dafef74af53669ef1cc9015f55e0ce809ead62aa", + "builtin-baseline": "33409307f1e3411112a0a6bbf3011ea3cca1bfc9", "dependencies": [ { "name": "curl" From 4b0b3c92c58fa418c8d374a994d57d273d706be0 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 13:01:15 -0700 Subject: [PATCH 30/37] Fixed cmake line for disabling otel --- sdk/eventhubs/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index d30c652d8d..ca060b3721 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -78,4 +78,4 @@ stages: # FETCH_SOURCE_DEPS is disabled because azure-messaging-eventhubs is not present in the vcpkg catalog at the current Azure SDK baseline commit. # Disabling DISABLE_AZURE_CORE_OPENTELEMETRY because eventhubs does not have a dependency on azure-core-opentelemetry, but azure core includes # azure-core-opentelemetry in builds unless disabled. - Value: '-DFETCH_SOURCE_DEPS=OFF -DDISABLE_AZURE_CORE_OPENTELEMETRY' + Value: '-DFETCH_SOURCE_DEPS=OFF -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON' From 073619f47909758736791b12258b9e415ef24409 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 13:26:00 -0700 Subject: [PATCH 31/37] Fixed path for blob checkpoint store --- sdk/eventhubs/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index ca060b3721..15099ff17a 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -37,14 +37,14 @@ stages: Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp - Name: azure-messaging-eventhubs-checkpointstore-blob - Path: azure-messaging-eventhubs-checkpointstore-blob + Path: blob-store VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp ArtifactsSource: - Name: azure-messaging-eventhubs Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp - Name: azure-messaging-eventhubs-checkpointstore-blob - Path: azure-messaging-eventhubs-checkpointstore-blob + Path: blob-store VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp TestEnv: - Name: AZURE_TENANT_ID From 8f8c3a6f9643e25f6eb4bb4e3be159334e6f1cf5 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 13:54:54 -0700 Subject: [PATCH 32/37] New name for blob checkpoint store --- sdk/eventhubs/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/eventhubs/CMakeLists.txt b/sdk/eventhubs/CMakeLists.txt index ab59299748..b46be0b3d2 100644 --- a/sdk/eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/CMakeLists.txt @@ -9,4 +9,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_subdirectory(azure-messaging-eventhubs) -add_subdirectory(azure-messaging-eventhubs-checkpointstore-blob) +#add_subdirectory(azure-messaging-eventhubs-checkpointstore-blob) +add_subdirectory(blob-store) From fb66a0635a1c566e7e4138876f87fa911cf2110e Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 15:09:41 -0700 Subject: [PATCH 33/37] doxygen fixes --- cmake-modules/AzureDoxygen.cmake | 2 +- sdk/eventhubs/blob-store/CMakeLists.txt | 3 ++- .../blob_checkpoint_store.hpp | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cmake-modules/AzureDoxygen.cmake b/cmake-modules/AzureDoxygen.cmake index 0db40ad8dd..759954d732 100644 --- a/cmake-modules/AzureDoxygen.cmake +++ b/cmake-modules/AzureDoxygen.cmake @@ -6,7 +6,7 @@ # Usage: generate_documentation(azure-core 1.0.0-preview.1) # Requires: Doxygen # Target name in the form of ${PROJECT_NAME}-docs (e.g. azure-core-docs) - +# Note that PROJECT_NAME is also the directory containing the package. function(generate_documentation PROJECT_NAME PROJECT_VERSION) if(BUILD_DOCUMENTATION) find_package(Doxygen 1.9.7 REQUIRED doxygen) diff --git a/sdk/eventhubs/blob-store/CMakeLists.txt b/sdk/eventhubs/blob-store/CMakeLists.txt index a25ea8b705..1ba590b6a5 100644 --- a/sdk/eventhubs/blob-store/CMakeLists.txt +++ b/sdk/eventhubs/blob-store/CMakeLists.txt @@ -87,7 +87,8 @@ target_link_libraries(azure-messaging-eventhubs-checkpoint-blob create_code_coverage(eventhubs azure-messaging-eventhubs-checkpoint-blob azure-messaging-eventhubs-blobcheckpointstore-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") -generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) +#generate_documentation(azure-messaging-eventhubs-checkpoint-blob ${AZ_LIBRARY_VERSION}) +generate_documentation(blob-store ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) add_subdirectory(test) diff --git a/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp b/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp index 2bdb19d350..b6a2fdfda3 100644 --- a/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp +++ b/sdk/eventhubs/blob-store/inc/azure/messaging/eventhubs/checkpointstore_blob/blob_checkpoint_store.hpp @@ -56,10 +56,24 @@ namespace Azure { namespace Messaging { namespace EventHubs { m_containerClient.CreateIfNotExists(); } + /**@brief ClaimOwnership Claims ownership for a particular partition. + * + * @param partitionOwnership - The list of partition ownerships this instance is claiming. + * @param context - The context for cancelling long running operations. + */ std::vector ClaimOwnership( std::vector const& partitionOwnership, Core::Context const& context = {}) override; + /**@brief List the checkpoints from storage. + * + * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. + * @param eventHubName - The name of the specific Event Hub. + * @param consumerGroup - The name of the specific consumer group. + * @param context - The context for cancelling long running operations. + * + * @return A list of checkpoints. + */ std::vector ListCheckpoints( std::string const& fullyQualifiedNamespace, std::string const& eventHubName, @@ -67,6 +81,13 @@ namespace Azure { namespace Messaging { namespace EventHubs { Core::Context const& context = {}) override; /**@brief ListOwnership lists all ownerships. + * + * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. + * @param eventHubName - The name of the specific Event Hub. + * @param consumerGroup - The name of the specific consumer group. + * @param context - The context for cancelling long running operations. + * + * @return A list of ownerships. */ std::vector ListOwnership( std::string const& fullyQualifiedNamespace, From 2d27f21d002b4efd5cfb47b70b744684d1323f60 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 15:12:45 -0700 Subject: [PATCH 34/37] Reverted otel change --- sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index 42dd2b8bba..09dadbbde2 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -10,6 +10,10 @@ az_vcpkg_integrate() cmake_minimum_required (VERSION 3.12) project(azure-core-tracing-opentelemetry LANGUAGES CXX) +if (NOT VCPKG_TARGET_TRIPLET MATCHES "windows" OR VCPKG_TARGET_TRIPLET MATCHES "static" OR NOT WIN32) + set(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY ON) +endif() + set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) From 56420defcf3b3324e522d1c19a785ddc6f785d66 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 15:31:30 -0700 Subject: [PATCH 35/37] Updated checkpoint store name to match location on disk --- sdk/eventhubs/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 15099ff17a..d77395c287 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -36,7 +36,7 @@ stages: - Name: azure-messaging-eventhubs Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp - - Name: azure-messaging-eventhubs-checkpointstore-blob + - Name: blob-store Path: blob-store VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp ArtifactsSource: From fa8094e131c9155bc36cdf891137517106557a97 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 15:32:27 -0700 Subject: [PATCH 36/37] Fixed path for doxygen --- eng/pipelines/templates/jobs/archetype-sdk-client.yml | 2 +- sdk/eventhubs/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 67286f4177..9ce96e0cda 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -254,7 +254,7 @@ jobs: } displayName: Copy CHANGELOG.md to package artifact - - script: cmake --build . --target ${{ artifact.Name }}-docs + - script: cmake --build . --target ${{ artifact.Path }}-docs workingDirectory: build displayName: Generate docs (${{ artifact.Name }}-docs) diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index d77395c287..15099ff17a 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -36,7 +36,7 @@ stages: - Name: azure-messaging-eventhubs Path: azure-messaging-eventhubs VcpkgPortName: azure-messaging-eventhubs-cpp - - Name: blob-store + - Name: azure-messaging-eventhubs-checkpointstore-blob Path: blob-store VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp ArtifactsSource: From 8f06822843e1e02a724252beaeef1f27b9ed54a0 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Tue, 19 Sep 2023 17:12:05 -0700 Subject: [PATCH 37/37] update recordings --- sdk/eventhubs/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/assets.json b/sdk/eventhubs/assets.json index 91124c6f5c..47e6227bc7 100644 --- a/sdk/eventhubs/assets.json +++ b/sdk/eventhubs/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/eventhubs", - "Tag": "cpp/eventhubs_72eef79be1" + "Tag": "cpp/eventhubs_d59a0a9f3c" }