Package com.daml.ledger.rxjava
Class DamlLedgerClient
- java.lang.Object
-
- com.daml.ledger.rxjava.DamlLedgerClient
-
- All Implemented Interfaces:
LedgerClient
public final class DamlLedgerClient extends java.lang.Object implements LedgerClient
ALedgerClientimplementation that connects to an existing Ledger and provides clients to query it. To use theDamlLedgerClient:- Create an instance of a
DamlLedgerClient.BuilderusingnewBuilder(String, int) - Specify an expected ledger identifier,
SslContext, and/or access token, depending on your needs - Invoke
DamlLedgerClient.Builder.build()to finalize and construct aDamlLedgerClient - Call the method
connect()to initialize the clients for that particular ledger - Retrieve one of the clients by using a getter, e.g.
getActiveContractSetClient()
Alternatively to
newBuilder(String, int), you can usenewBuilder(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
SslContextobject for mutual authentication please refer to the section on security in the grpc-java documentation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDamlLedgerClient.Builder
-
Constructor Summary
Constructors Constructor Description DamlLedgerClient(java.util.Optional<java.lang.String> expectedLedgerId, @NonNull io.grpc.ManagedChannel channel, java.util.Optional<java.time.Duration> timeout)Deprecated.since 0.13.38, please usenewBuilder(java.lang.String, int)
-
Method Summary
-
-
-
Constructor Detail
-
DamlLedgerClient
@Deprecated public DamlLedgerClient(java.util.Optional<java.lang.String> expectedLedgerId, @NonNull io.grpc.ManagedChannel channel, java.util.Optional<java.time.Duration> timeout)Deprecated.since 0.13.38, please usenewBuilder(java.lang.String, int)Creates aDamlLedgerClientwith a previously createdManagedChannel. This is useful in case additional settings need to be configured for the connection to the ledger (e.g. keep alive timeout).- Parameters:
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.
-
-
Method Detail
-
newBuilder
public static DamlLedgerClient.Builder newBuilder(@NonNull java.lang.String host, int port)
Create a newDamlLedgerClient.Builderwith the given parametersUseful as a shortcut unless you have to customize the
NettyChannelBuilderbeyond the builder's capabilities
-
newBuilder
public static DamlLedgerClient.Builder newBuilder(@NonNull io.grpc.netty.NettyChannelBuilder channelBuilder)
Create a newDamlLedgerClient.Builderwith the given parametersUseful to customize the
NettyChannelBuilderbeyond the builder's capabilities, otherwisenewBuilder(String, int)is probably more suited for your use case
-
forLedgerIdAndHost
@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)
Deprecated.since 0.13.38, please useDamlLedgerClient(NettyChannelBuilder, Optional, Optional, Optional)or even better eithernewBuilder(java.lang.String, int)Creates aDamlLedgerClientconnected to a Ledger identified by the ip and port.- Parameters:
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 viaGrpcSslContexts.forClient().
-
forHostWithLedgerIdDiscovery
@Deprecated public 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 useDamlLedgerClient(NettyChannelBuilder, Optional, Optional, Optional)or even better eithernewBuilder(java.lang.String, int)LikeforLedgerIdAndHost(String, String, int, Optional)but with the ledger-id automatically discovered instead of provided.
-
connect
public void connect()
Connects this instance of theDamlLedgerClientto the Ledger.
-
getLedgerId
public java.lang.String getLedgerId()
- Specified by:
getLedgerIdin interfaceLedgerClient- Returns:
- The identifier of the Ledger connected to this
LedgerClient
-
getActiveContractSetClient
public ActiveContractsClient getActiveContractSetClient()
- Specified by:
getActiveContractSetClientin interfaceLedgerClient
-
getTransactionsClient
public TransactionsClient getTransactionsClient()
- Specified by:
getTransactionsClientin interfaceLedgerClient
-
getCommandClient
public CommandClient getCommandClient()
- Specified by:
getCommandClientin interfaceLedgerClient
-
getCommandCompletionClient
public CommandCompletionClient getCommandCompletionClient()
- Specified by:
getCommandCompletionClientin interfaceLedgerClient
-
getCommandSubmissionClient
public CommandSubmissionClient getCommandSubmissionClient()
- Specified by:
getCommandSubmissionClientin interfaceLedgerClient
-
getLedgerIdentityClient
public LedgerIdentityClient getLedgerIdentityClient()
- Specified by:
getLedgerIdentityClientin interfaceLedgerClient
-
getPackageClient
public PackageClient getPackageClient()
- Specified by:
getPackageClientin interfaceLedgerClient
-
getLedgerConfigurationClient
public LedgerConfigurationClient getLedgerConfigurationClient()
- Specified by:
getLedgerConfigurationClientin interfaceLedgerClient
-
getTimeClient
public TimeClient getTimeClient()
- Specified by:
getTimeClientin interfaceLedgerClient
-
close
public void close() throws java.lang.Exception- Throws:
java.lang.Exception
-
-