com.amazonaws.services.kafkaconnect.AWSKafkaConnectAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-kafkaconnect Show documentation
Show all versions of aws-java-sdk-kafkaconnect Show documentation
The AWS Java SDK for Managed Streaming for Kafka Connect module holds the client classes that are used for communicating with Managed Streaming for Kafka Connect Service
The newest version!
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.kafkaconnect;
import javax.annotation.Generated;
import com.amazonaws.services.kafkaconnect.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing Kafka Connect asynchronously. Each asynchronous method will return a Java Future object
* representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
* notification when an asynchronous operation completes.
*
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSKafkaConnectAsyncClient extends AWSKafkaConnectClient implements AWSKafkaConnectAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSKafkaConnectAsyncClientBuilder asyncBuilder() {
return AWSKafkaConnectAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on Kafka Connect using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSKafkaConnectAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on Kafka Connect using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSKafkaConnectAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) {
super(asyncClientParams, endpointDiscoveryEnabled);
this.executorService = asyncClientParams.getExecutor();
}
/**
* Returns the executor service used by this client to execute async requests.
*
* @return The executor service used by this client to execute async requests.
*/
public ExecutorService getExecutorService() {
return executorService;
}
@Override
public java.util.concurrent.Future createConnectorAsync(CreateConnectorRequest request) {
return createConnectorAsync(request, null);
}
@Override
public java.util.concurrent.Future createConnectorAsync(final CreateConnectorRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateConnectorRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateConnectorResult call() throws Exception {
CreateConnectorResult result = null;
try {
result = executeCreateConnector(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future createCustomPluginAsync(CreateCustomPluginRequest request) {
return createCustomPluginAsync(request, null);
}
@Override
public java.util.concurrent.Future createCustomPluginAsync(final CreateCustomPluginRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateCustomPluginRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateCustomPluginResult call() throws Exception {
CreateCustomPluginResult result = null;
try {
result = executeCreateCustomPlugin(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future createWorkerConfigurationAsync(CreateWorkerConfigurationRequest request) {
return createWorkerConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future createWorkerConfigurationAsync(final CreateWorkerConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateWorkerConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateWorkerConfigurationResult call() throws Exception {
CreateWorkerConfigurationResult result = null;
try {
result = executeCreateWorkerConfiguration(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteConnectorAsync(DeleteConnectorRequest request) {
return deleteConnectorAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteConnectorAsync(final DeleteConnectorRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteConnectorRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteConnectorResult call() throws Exception {
DeleteConnectorResult result = null;
try {
result = executeDeleteConnector(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteCustomPluginAsync(DeleteCustomPluginRequest request) {
return deleteCustomPluginAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteCustomPluginAsync(final DeleteCustomPluginRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteCustomPluginRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteCustomPluginResult call() throws Exception {
DeleteCustomPluginResult result = null;
try {
result = executeDeleteCustomPlugin(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteWorkerConfigurationAsync(DeleteWorkerConfigurationRequest request) {
return deleteWorkerConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteWorkerConfigurationAsync(final DeleteWorkerConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteWorkerConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteWorkerConfigurationResult call() throws Exception {
DeleteWorkerConfigurationResult result = null;
try {
result = executeDeleteWorkerConfiguration(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeConnectorAsync(DescribeConnectorRequest request) {
return describeConnectorAsync(request, null);
}
@Override
public java.util.concurrent.Future describeConnectorAsync(final DescribeConnectorRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeConnectorRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeConnectorResult call() throws Exception {
DescribeConnectorResult result = null;
try {
result = executeDescribeConnector(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeCustomPluginAsync(DescribeCustomPluginRequest request) {
return describeCustomPluginAsync(request, null);
}
@Override
public java.util.concurrent.Future describeCustomPluginAsync(final DescribeCustomPluginRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeCustomPluginRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeCustomPluginResult call() throws Exception {
DescribeCustomPluginResult result = null;
try {
result = executeDescribeCustomPlugin(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeWorkerConfigurationAsync(DescribeWorkerConfigurationRequest request) {
return describeWorkerConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future describeWorkerConfigurationAsync(final DescribeWorkerConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeWorkerConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeWorkerConfigurationResult call() throws Exception {
DescribeWorkerConfigurationResult result = null;
try {
result = executeDescribeWorkerConfiguration(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listConnectorsAsync(ListConnectorsRequest request) {
return listConnectorsAsync(request, null);
}
@Override
public java.util.concurrent.Future listConnectorsAsync(final ListConnectorsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListConnectorsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListConnectorsResult call() throws Exception {
ListConnectorsResult result = null;
try {
result = executeListConnectors(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listCustomPluginsAsync(ListCustomPluginsRequest request) {
return listCustomPluginsAsync(request, null);
}
@Override
public java.util.concurrent.Future listCustomPluginsAsync(final ListCustomPluginsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListCustomPluginsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListCustomPluginsResult call() throws Exception {
ListCustomPluginsResult result = null;
try {
result = executeListCustomPlugins(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listWorkerConfigurationsAsync(ListWorkerConfigurationsRequest request) {
return listWorkerConfigurationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listWorkerConfigurationsAsync(final ListWorkerConfigurationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListWorkerConfigurationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListWorkerConfigurationsResult call() throws Exception {
ListWorkerConfigurationsResult result = null;
try {
result = executeListWorkerConfigurations(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateConnectorAsync(UpdateConnectorRequest request) {
return updateConnectorAsync(request, null);
}
@Override
public java.util.concurrent.Future updateConnectorAsync(final UpdateConnectorRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateConnectorRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateConnectorResult call() throws Exception {
UpdateConnectorResult result = null;
try {
result = executeUpdateConnector(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending
* asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should
* call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to
* calling this method.
*/
@Override
public void shutdown() {
super.shutdown();
executorService.shutdownNow();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy