public final class DamlLedgerClient extends java.lang.Object implements LedgerClient
LedgerClient
implementation that connects to
an existing Ledger and provides clients to query it. To use the DamlLedgerClient
:
DamlLedgerClient.Builder
using newBuilder(String, int)
SslContext
, and/or access token, depending on your needsDamlLedgerClient.Builder.build()
to finalize and construct a DamlLedgerClient
connect()
to initialize the clients for that particular ledgergetActiveContractSetClient()
newBuilder(String, int)
, you can use newBuilder(NettyChannelBuilder)
to make sure you can specify additional properties for the channel you're building, such as the maximum inbound message size.
For information on how to set up an SslContext
object for mutual authentication please refer to
the section on security in the grpc-java documentation.Modifier and Type | Class and Description |
---|---|
static class |
DamlLedgerClient.Builder |
Constructor and Description |
---|
DamlLedgerClient(java.util.Optional<java.lang.String> expectedLedgerId,
@NonNull io.grpc.ManagedChannel channel)
Deprecated.
since 0.13.38, please use
newBuilder(java.lang.String, int) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect()
Connects this instance of the
DamlLedgerClient to the Ledger. |
static DamlLedgerClient |
forHostWithLedgerIdDiscovery(@NonNull java.lang.String hostIp,
int hostPort,
java.util.Optional<io.netty.handler.ssl.SslContext> sslContext)
Deprecated.
since 0.13.38, please use
DamlLedgerClient(NettyChannelBuilder, Optional, Optional) or even better either newBuilder(java.lang.String, int) |
static DamlLedgerClient |
forLedgerIdAndHost(@NonNull java.lang.String ledgerId,
@NonNull java.lang.String hostIp,
int hostPort,
@NonNull java.util.Optional<io.netty.handler.ssl.SslContext> sslContext)
Deprecated.
since 0.13.38, please use
DamlLedgerClient(NettyChannelBuilder, Optional, Optional) or even better either newBuilder(java.lang.String, int) |
ActiveContractsClient |
getActiveContractSetClient() |
CommandClient |
getCommandClient() |
CommandCompletionClient |
getCommandCompletionClient() |
CommandSubmissionClient |
getCommandSubmissionClient() |
LedgerConfigurationClient |
getLedgerConfigurationClient() |
java.lang.String |
getLedgerId() |
LedgerIdentityClient |
getLedgerIdentityClient() |
PackageClient |
getPackageClient() |
TimeClient |
getTimeClient() |
TransactionsClient |
getTransactionsClient() |
static DamlLedgerClient.Builder |
newBuilder(@NonNull io.grpc.netty.NettyChannelBuilder channelBuilder)
Create a new
DamlLedgerClient.Builder with the given parameters
Useful to customize the NettyChannelBuilder beyond the builder's capabilities,
otherwise newBuilder(String, int) is probably more suited for your use case |
static DamlLedgerClient.Builder |
newBuilder(@NonNull java.lang.String host,
int port)
Create a new
DamlLedgerClient.Builder with the given parameters
Useful as a shortcut unless you have to customize the NettyChannelBuilder beyond the builder's capabilities |
@Deprecated public DamlLedgerClient(java.util.Optional<java.lang.String> expectedLedgerId, @NonNull io.grpc.ManagedChannel channel)
newBuilder(java.lang.String, int)
DamlLedgerClient
with a previously created ManagedChannel
. This is useful in
case additional settings need to be configured for the connection to the ledger (e.g. keep alive timeout).expectedLedgerId
- If the value is present, connect()
throws an exception
if the provided ledger id does not match the ledger id provided by the ledger.channel
- A user provided instance of @ManagedChannel
.public static DamlLedgerClient.Builder newBuilder(@NonNull java.lang.String host, int port)
DamlLedgerClient.Builder
with the given parameters
Useful as a shortcut unless you have to customize the NettyChannelBuilder
beyond the builder's capabilitiespublic static DamlLedgerClient.Builder newBuilder(@NonNull io.grpc.netty.NettyChannelBuilder channelBuilder)
DamlLedgerClient.Builder
with the given parameters
Useful to customize the NettyChannelBuilder
beyond the builder's capabilities,
otherwise newBuilder(String, int)
is probably more suited for your use case@Deprecated public static DamlLedgerClient forLedgerIdAndHost(@NonNull java.lang.String ledgerId, @NonNull java.lang.String hostIp, int hostPort, @NonNull java.util.Optional<io.netty.handler.ssl.SslContext> sslContext)
DamlLedgerClient(NettyChannelBuilder, Optional, Optional)
or even better either newBuilder(java.lang.String, int)
DamlLedgerClient
connected to a Ledger
identified by the ip and port.ledgerId
- The expected ledger-idhostIp
- The ip of the LedgerhostPort
- The port of the LedgersslContext
- If present, it will be used to establish a TLS connection. If empty, an unsecured plaintext connection will be used.
Must be an SslContext created for client applications via GrpcSslContexts.forClient()
.@Deprecated public static DamlLedgerClient forHostWithLedgerIdDiscovery(@NonNull java.lang.String hostIp, int hostPort, java.util.Optional<io.netty.handler.ssl.SslContext> sslContext)
DamlLedgerClient(NettyChannelBuilder, Optional, Optional)
or even better either newBuilder(java.lang.String, int)
forLedgerIdAndHost(String, String, int, Optional)
but with the ledger-id
automatically discovered instead of provided.public void connect()
DamlLedgerClient
to the Ledger.public java.lang.String getLedgerId()
getLedgerId
in interface LedgerClient
LedgerClient
public ActiveContractsClient getActiveContractSetClient()
getActiveContractSetClient
in interface LedgerClient
public TransactionsClient getTransactionsClient()
getTransactionsClient
in interface LedgerClient
public CommandClient getCommandClient()
getCommandClient
in interface LedgerClient
public CommandCompletionClient getCommandCompletionClient()
getCommandCompletionClient
in interface LedgerClient
public CommandSubmissionClient getCommandSubmissionClient()
getCommandSubmissionClient
in interface LedgerClient
public LedgerIdentityClient getLedgerIdentityClient()
getLedgerIdentityClient
in interface LedgerClient
public PackageClient getPackageClient()
getPackageClient
in interface LedgerClient
public LedgerConfigurationClient getLedgerConfigurationClient()
getLedgerConfigurationClient
in interface LedgerClient
public TimeClient getTimeClient()
getTimeClient
in interface LedgerClient
public void close() throws java.lang.Exception
java.lang.Exception