Skip to content
Discussions/App Development/Active Contract Set Service returns a Stream Arrays/List: how big can the arrays/List be per event in the stream?Forum ↗

Active Contract Set Service returns a Stream Arrays/List: how big can the arrays/List be per event in the stream?

App Development7 posts379 views1 likesLast activity Jun 2022
ST
StephenOTTOP
Jun 2022

Continuation of Java Bindings: ledgerClient.activeContractSetClient.getActiveContracts returns flowable but is it actually a stream? - #8 by Stephen

The ACS API returns a list of contracts in each event in the stream: Ledger API Reference — Daml SDK 2.2.0 documentation

But how big can each list be? What is the max number of contracts that will be returned per event?

GE
gerolf
Jun 2022

Hi @StephenOTT,

Considering this sentence from the documentation you linked to:

The list of contracts that were introduced by the workflow with workflow_id

While the Ledger API does not guarantee this, in practice this means that each individual response message contains the number of CreatedEvents of a transaction, that were still active at the time of the request. So the maximum number of contracts in this list is the same as the number of contracts created in a transaction, that haven’t been archived yet.

Update: Keep in mind that the specific Ledger API implementation is also free to send one CreatedEvent per GetActiveContractsResponse. The comment above is about the upper bound of the list.

ST
StephenOTT
Jun 2022

@gerolf thanks for that details. WorkflowID == transactionId ?

GE
gerolf
Jun 2022

No, the workflowID can be used to associate multiple transactions to the same business workflow. This is a user/application provided field in the Commands message.

ST
StephenOTT
Jun 2022

@gerolf so based on your previous two comments:

  1. If workflow id was used /provided then the api call returns the contracts associated with that id (across multiple transactions)

  2. If workflow id was not provided then the api returns contracts per transaction

?

GE
gerolf
Jun 2022

In practice across recent releases of the Daml SDK, you will actually always get a single contract in each GetActiveContractsResponse.

ST
StephenOTT
Jun 2022

@gerolf thanks!

← Back to Discussions