Package datahub.client.rest
Class RestEmitter
- java.lang.Object
-
- datahub.client.rest.RestEmitter
-
-
Constructor Summary
Constructors Constructor Description RestEmitter(RestEmitterConfig config)
The default constructor, prefer using the `create` factory method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static RestEmitter
create(java.util.function.Consumer<RestEmitterConfig.RestEmitterConfigBuilder> builderSupplier)
Constructing a REST Emitter follows a lambda-based fluent builder pattern using the `create` method.static RestEmitter
createWithDefaults()
Creates a RestEmitter with default settings.java.util.concurrent.Future<MetadataWriteResponse>
emit(com.linkedin.mxe.MetadataChangeProposal mcp, Callback callback)
Asynchronously emit aMetadataChangeProposal
event.java.util.concurrent.Future<MetadataWriteResponse>
emit(MetadataChangeProposalWrapper mcpw, Callback callback)
Asynchronously emit aMetadataChangeProposalWrapper
event.java.util.concurrent.Future<MetadataWriteResponse>
emit(java.util.List<UpsertAspectRequest> request, Callback callback)
Asynchronously emit aUpsertAspectRequest
.boolean
testConnection()
Test that the emitter can establish a valid connection to the DataHub platform
-
-
-
Constructor Detail
-
RestEmitter
public RestEmitter(RestEmitterConfig config)
The default constructor, prefer using the `create` factory method.- Parameters:
config
-
-
-
Method Detail
-
create
public static RestEmitter create(java.util.function.Consumer<RestEmitterConfig.RestEmitterConfigBuilder> builderSupplier)
Constructing a REST Emitter follows a lambda-based fluent builder pattern using the `create` method. e.g. RestEmitter emitter = RestEmitter.create(b :: b .server("http://localhost:8080") // coordinates of gms server .extraHeaders(Collections.singletonMap("Custom-Header", "custom-val") ); You can also customize the underlying http client by calling the `customizeHttpAsyncClient` method on the builder. e.g. RestEmitter emitter = RestEmitter.create(b :: b .server("http://localhost:8080") .extraHeaders(Collections.singletonMap("Custom-Header", "custom-val") .customizeHttpAsyncClient(c :: c.setConnectionTimeToLive(30, TimeUnit.SECONDS)) );- Parameters:
builderSupplier
-- Returns:
- a constructed RestEmitter. Call #testConnection to make sure this emitter has a valid connection to the server
-
createWithDefaults
public static RestEmitter createWithDefaults()
Creates a RestEmitter with default settings.- Returns:
- a constructed RestEmitter. Call #test_connection to validate that this emitter can communicate with the server.
-
emit
public java.util.concurrent.Future<MetadataWriteResponse> emit(MetadataChangeProposalWrapper mcpw, Callback callback) throws java.io.IOException
Description copied from interface:Emitter
Asynchronously emit aMetadataChangeProposalWrapper
event.
-
emit
public java.util.concurrent.Future<MetadataWriteResponse> emit(com.linkedin.mxe.MetadataChangeProposal mcp, Callback callback) throws java.io.IOException
Description copied from interface:Emitter
Asynchronously emit aMetadataChangeProposal
event. Prefer using the sibling method that accepts aMetadataChangeProposalWrapper
event as those are friendlier to construct.
-
testConnection
public boolean testConnection() throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
Description copied from interface:Emitter
Test that the emitter can establish a valid connection to the DataHub platform- Specified by:
testConnection
in interfaceEmitter
- Returns:
- true if a valid connection can be established, false or throws one of the exceptions otherwise
- Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
emit
public java.util.concurrent.Future<MetadataWriteResponse> emit(java.util.List<UpsertAspectRequest> request, Callback callback) throws java.io.IOException
Description copied from interface:Emitter
Asynchronously emit aUpsertAspectRequest
.
-
-