Skip to content
Discussions/App Development/Daml Java Bindings: Use of Flowable vs Single (ex: Get Users vs Get Packages)Forum ↗

Daml Java Bindings: Use of Flowable vs Single (ex: Get Users vs Get Packages)

App Development5 posts244 views1 likesLast activity Jun 2022
ST
StephenOTTOP
Jun 2022

I notice some differences in the return types of some of the clients in the Java bindings:

Example: using ledgerClient.packageClient.listPackages() returns a Flowable but running ledgerClient.userManagementClient.listUsers() returns a Single.

Is this by design? why is list of packages a publisher of flowable but users returning a single?

Thanks!

ST
stefanobaghino-da
Jun 2022

At its core, the client libraries exposed by the Java bindings are a bit more high-level than the callback-based gRPC-generated code. Still, they are a relatively thin shim. This means that when the Ledger API returns a stream, an RxJAva Flowable is returned by the Java bindings and when a single result is returned instead an RxJava Single is returned. The user management API has been designed more recently (it’s part of the Ledger API only since 2.0) and followed slightly different design patterns (presented here) than the package management API, which results in this discrepancy.

ST
StephenOTT
Jun 2022

@stefanobaghino-da is the bindings supposed to be updated with pagination support? ListUsers() does not seem to support passing the ListUsersRequest object:

ST
stefanobaghino-da
Jun 2022

Thanks for letting us know, I checked the implementation and this looks like a bug. Based on what I found you should be able to retrieve the first 1000 users as that is the default page size in the implementation, but without a token that’s the maximum extent to which you can go. I opened this ticket to keep track of the issue.

ST
StephenOTT
Jun 2022

Great thanks

← Back to Discussions