Ledge API connections in a Java project

I have a Java integration app (spring boot) that monitors various contracts on the ledger API using Java bindings. Within the app I have multiple Java service classes, with each Java service class monitoring a specific set of contracts.

Should each Java service class establish/get/create its own connection to the ledger (via DamlLedgerClient), and therefore potentially have multiple open connections to the leger at any one time by multiple Java classes within the same app, or should there be only one open connection (potentially exposed via a singleton class) used by all the Java service classes?

Thanks,
Yazan

1 Like