Skip to content
CCPEDIAby Unity Nodes
App Development

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

7 posts438 views1 likesLast activity Jun 2022

  1. StephenOTTOP

    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?

  2. gerolf

    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.

  3. StephenOTT

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

  4. gerolf

    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.

  5. StephenOTT

    @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

    ?

  6. gerolf

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

  7. StephenOTT 1

    @gerolf thanks!