From 675046d03137c0b3e36a2b62ef3a4d7855d2d1ea Mon Sep 17 00:00:00 2001 From: vcolin7 Date: Wed, 15 Jan 2025 16:32:12 -0800 Subject: [PATCH] Remove deprecated + past EOL Track 1 EventHubs Extensions library. --- .github/CODEOWNERS | 3 - eng/.docsettings.yml | 2 - eng/versioning/version_data.txt | 1 - sdk/eventhubs/ci.data.yml | 7 - .../pom.xml | 98 ------------ .../appender/EventHubsAppender.java | 140 ------------------ .../extensions/appender/EventHubsManager.java | 48 ------ sdk/eventhubs/pom.xml | 1 - 8 files changed, 300 deletions(-) delete mode 100644 sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml delete mode 100644 sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsAppender.java delete mode 100644 sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsManager.java diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9ea66a8abf38b..9c23bfb69c88d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -459,9 +459,6 @@ # PRLabel: %Event Hubs /sdk/eventhubs/microsoft-azure-eventhubs-eph/ @sjkwak -# PRLabel: %Event Hubs -/sdk/eventhubs/microsoft-azure-eventhubs-extensions/ @sjkwak - # ServiceLabel: %Health Deidentification # PRLabel: %Health Deidentification /sdk/healthdataaiservices/ @GrahamMThomas @alexathomases @billwert diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index bbb5c3b0eeec8..fe80ed5dca5ec 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -50,7 +50,6 @@ known_presence_issues: - ['sdk/cognitiveservices/ms-azure-cs-videosearch', '#2847'] - ['sdk/cognitiveservices/ms-azure-cs-visualsearch', '#2847'] - ['sdk/cognitiveservices/ms-azure-cs-websearch', '#2847'] - - ['sdk/eventhubs/microsoft-azure-eventhubs-extensions', '#2847'] - ['sdk/mediaservices/microsoft-azure-media', '#2847'] - ['sdk/servicebus/microsoft-azure-servicebus', '#2847'] # Changelog List @@ -80,7 +79,6 @@ known_presence_issues: - ['sdk/eventgrid/azure-messaging-eventgrid/CHANGELOG.md', '#2847'] - ['sdk/eventhubs/microsoft-azure-eventhubs/CHANGELOG.md', '#2847'] - ['sdk/eventhubs/microsoft-azure-eventhubs-eph/CHANGELOG.md', '#2847'] - - ['sdk/eventhubs/microsoft-azure-eventhubs-extensions/CHANGELOG.md', '#2847'] - ['sdk/keyvault/microsoft-azure-keyvault/CHANGELOG.md', '#2847'] - ['sdk/keyvault/microsoft-azure-keyvault-core/CHANGELOG.md', '#2847'] - ['sdk/keyvault/microsoft-azure-keyvault-cryptography/CHANGELOG.md', '#2847'] diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index c283e965e45c8..73f9cddc208a3 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -24,6 +24,5 @@ com.microsoft.azure.cognitiveservices:azure-cognitiveservices-faceapi;1.0.1-beta com.microsoft.azure.cognitiveservices:azure-cognitiveservices-qnamaker;1.0.0-beta.2;1.0.0-beta.3 com.microsoft.azure:azure-eventhubs;3.3.0;3.4.0-beta.1 com.microsoft.azure:azure-eventhubs-eph;3.3.0;3.4.0-beta.1 -com.microsoft.azure:azure-eventhubs-extensions;3.3.2;3.4.0-beta.1 com.microsoft.azure:azure-servicebus;3.6.7;3.7.0-beta.1 com.microsoft.azure:azure-media;1.0.0-beta.1;1.0.0-beta.1 diff --git a/sdk/eventhubs/ci.data.yml b/sdk/eventhubs/ci.data.yml index 6ff1e92b2b407..a2e0faa660fde 100644 --- a/sdk/eventhubs/ci.data.yml +++ b/sdk/eventhubs/ci.data.yml @@ -12,12 +12,10 @@ trigger: - sdk/eventhubs/ci.data.yml - sdk/eventhubs/microsoft-azure-eventhubs/ - sdk/eventhubs/microsoft-azure-eventhubs-eph/ - - sdk/eventhubs/microsoft-azure-eventhubs-extensions/ exclude: - sdk/eventhubs/pom.xml - sdk/eventhubs/microsoft-azure-eventhubs/pom.xml - sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml - - sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml pr: branches: @@ -31,12 +29,10 @@ pr: - sdk/eventhubs/ci.data.yml - sdk/eventhubs/microsoft-azure-eventhubs/ - sdk/eventhubs/microsoft-azure-eventhubs-eph/ - - sdk/eventhubs/microsoft-azure-eventhubs-extensions/ exclude: - sdk/eventhubs/pom.xml - sdk/eventhubs/microsoft-azure-eventhubs/pom.xml - sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml - - sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -50,6 +46,3 @@ extends: - name: azure-eventhubs-eph groupId: com.microsoft.azure safeName: azureeventhubseph - - name: azure-eventhubs-extensions - groupId: com.microsoft.azure - safeName: azureeventhubsextensions diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml deleted file mode 100644 index 07ad0163db6ab..0000000000000 --- a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - com.azure - azure-data-sdk-parent - 1.3.0 - ../../parents/azure-data-sdk-parent - - - 4.0.0 - com.microsoft.azure - azure-eventhubs-extensions - 3.4.0-beta.1 - - Microsoft Azure SDK for Event Hubs Extensions - Extensions built on Microsoft Azure Event Hubs${line.separator} - This library has been replaced by new Azure SDKs, you can read about them at https://aka.ms/azsdkvalueprop. The latest libraries to interact with the Azure Event Hubs service are:${line.separator} - 1. https://central.sonatype.com/artifact/com.azure/azure-messaging-eventhubs${line.separator} - 2. https://central.sonatype.com/artifact/com.azure/azure-messaging-eventhubs-checkpointstore-blob${line.separator} - It is recommended that you move to the new package. - - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - - - - - com.microsoft.azure - azure-eventhubs - 3.4.0-beta.1 - - - org.apache.logging.log4j - log4j-api - 2.17.2 - - - org.apache.logging.log4j - log4j-core - 2.17.2 - - - - junit - junit - 4.13.2 - test - - - org.slf4j - slf4j-simple - 1.7.36 - test - - - com.microsoft.azure - msal4j - 1.17.2 - test - - - com.microsoft.azure - adal4j - 1.6.5 - test - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.5.0 - - true - true - - - - - - diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsAppender.java b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsAppender.java deleted file mode 100644 index 988b52c203b3b..0000000000000 --- a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsAppender.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.azure.eventhubs.extensions.appender; - -import org.apache.logging.log4j.core.Filter; -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.appender.AbstractAppender; -import org.apache.logging.log4j.core.appender.AppenderLoggingException; -import org.apache.logging.log4j.core.config.plugins.Plugin; -import org.apache.logging.log4j.core.config.plugins.PluginAttribute; -import org.apache.logging.log4j.core.config.plugins.PluginElement; -import org.apache.logging.log4j.core.config.plugins.PluginFactory; -import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required; -import org.apache.logging.log4j.core.util.StringEncoder; - -import java.io.Serializable; - -import java.util.Locale; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.atomic.AtomicInteger; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Sends {@link LogEvent}'s to Microsoft Azure EventHubs. - * By default, tuned for high performance and hence, pushes a batch of Events. - */ -@Plugin(name = "EventHub", category = "Core", elementType = "appender", printObject = true) -public final class EventHubsAppender extends AbstractAppender { - private static final int MAX_BATCH_SIZE_BYTES = 200 * 1024; - - // this constant is tuned to use the MaximumAllowedMessageSize(256K) including AMQP-Headers for a LogEvent of 1Char - private static final int MAX_BATCH_SIZE = 21312; - private static final long serialVersionUID = 1L; - - private final EventHubsManager eventHubsManager; - private final boolean immediateFlush; - private final AtomicInteger currentBufferedSizeBytes; - private final ConcurrentLinkedQueue logEvents; - - private EventHubsAppender( - final String name, - final Filter filter, - final Layout layout, - final boolean ignoreExceptions, - final EventHubsManager eventHubsManager, - final boolean immediateFlush) { - super(name, filter, layout, ignoreExceptions); - - this.eventHubsManager = eventHubsManager; - this.immediateFlush = immediateFlush; - this.logEvents = new ConcurrentLinkedQueue(); - this.currentBufferedSizeBytes = new AtomicInteger(); - } - - @PluginFactory - public static EventHubsAppender createAppender( - @Required(message = "Provide a Name for EventHubs Log4j Appender") @PluginAttribute("name") final String name, - @PluginElement("Filter") final Filter filter, - @PluginElement("Layout") final Layout layout, - @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final boolean ignoreExceptions, - @Required(message = "Provide EventHub connection string to append the events to") @PluginAttribute("eventHubConnectionString") final String connectionString, - @PluginAttribute(value = "immediateFlush", defaultBoolean = false) final boolean immediateFlush) { - final EventHubsManager eventHubsManager = new EventHubsManager(name, connectionString); - return new EventHubsAppender(name, filter, layout, ignoreExceptions, eventHubsManager, immediateFlush); - } - - @Override - public void append(LogEvent logEvent) { - byte[] serializedLogEvent = null; - - try { - Layout layout = getLayout(); - - if (layout != null) { - serializedLogEvent = layout.toByteArray(logEvent); - } else { - serializedLogEvent = StringEncoder.toBytes(logEvent.getMessage().getFormattedMessage(), UTF_8); - } - - if (serializedLogEvent != null) { - if (this.immediateFlush) { - this.eventHubsManager.send(serializedLogEvent); - return; - } else { - int currentSize = this.currentBufferedSizeBytes.addAndGet(serializedLogEvent.length); - this.logEvents.offer(serializedLogEvent); - - if (currentSize < EventHubsAppender.MAX_BATCH_SIZE_BYTES - && this.logEvents.size() < EventHubsAppender.MAX_BATCH_SIZE - && !logEvent.isEndOfBatch()) { - return; - } - - logEvent.setEndOfBatch(true); - - this.eventHubsManager.send(this.logEvents); - - this.logEvents.clear(); - this.currentBufferedSizeBytes.set(0); - } - } - } catch (final Throwable exception) { - AppenderLoggingException appenderLoggingException = exception instanceof AppenderLoggingException - ? (AppenderLoggingException) exception - : new AppenderLoggingException("Appending logEvent to EventHubs failed: " + exception.getMessage(), exception); - - LOGGER.error(String.format(Locale.US, "[%s] Appender failed to logEvent to EventHub.", this.getName())); - - // remove the current LogEvent from the inMem Q - to avoid replay - if (serializedLogEvent != null && this.logEvents.remove(serializedLogEvent)) { - this.currentBufferedSizeBytes.addAndGet(-1 * serializedLogEvent.length); - } - - throw appenderLoggingException; - } - } - - @Override - public void start() { - super.start(); - - try { - this.eventHubsManager.startup(); - } catch (Throwable exception) { - final String errMsg = String.format(Locale.US, "[%s] Appender initialization failed with error: [%s]", this.getName(), exception.getMessage()); - - LOGGER.error(errMsg); - throw new AppenderLoggingException(errMsg, exception); - } - } - - @Override - public void stop() { - super.stop(); - this.eventHubsManager.release(); - } -} diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsManager.java b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsManager.java deleted file mode 100644 index aa22b28b12004..0000000000000 --- a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/src/main/java/com/microsoft/azure/eventhubs/extensions/appender/EventHubsManager.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.azure.eventhubs.extensions.appender; - -import com.microsoft.azure.eventhubs.EventData; -import com.microsoft.azure.eventhubs.EventHubClient; -import com.microsoft.azure.eventhubs.EventHubException; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.appender.AbstractManager; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - -public final class EventHubsManager extends AbstractManager { - private static final ScheduledExecutorService EXECUTOR_SERVICE = Executors.newScheduledThreadPool(1); - private final String eventHubConnectionString; - private EventHubClient eventHubSender; - - protected EventHubsManager(final String name, final String eventHubConnectionString) { - super(LoggerContext.getContext(true), name); - this.eventHubConnectionString = eventHubConnectionString; - } - - public void send(final byte[] msg) throws EventHubException { - if (msg != null) { - EventData data = EventData.create(msg); - this.eventHubSender.sendSync(data); - } - } - - public void send(final Iterable messages) throws EventHubException { - if (messages != null) { - LinkedList events = new LinkedList(); - for (byte[] message : messages) { - events.add(EventData.create(message)); - } - - this.eventHubSender.sendSync(events); - } - } - - public void startup() throws EventHubException, IOException { - this.eventHubSender = EventHubClient.createFromConnectionStringSync(this.eventHubConnectionString, EXECUTOR_SERVICE); - } -} diff --git a/sdk/eventhubs/pom.xml b/sdk/eventhubs/pom.xml index 9457703f1141c..70104d96adc02 100644 --- a/sdk/eventhubs/pom.xml +++ b/sdk/eventhubs/pom.xml @@ -11,7 +11,6 @@ microsoft-azure-eventhubs microsoft-azure-eventhubs-eph - microsoft-azure-eventhubs-extensions azure-messaging-eventhubs azure-messaging-eventhubs-checkpointstore-blob azure-messaging-eventhubs-checkpointstore-jedis