Jul 03 2018
- last edited on
May 26 2021
Although I understand that a new contract will be written asynchronously (although a contract record is immediately written to Sql Server with a pending ledger identifier once it is pulled off the queue by the Worker node Docker endpoint), it seems there isn't currently a reliable way to tie up the contract back to the caller who created it.
The closest I've gotten thus far is to use the Rest API ContractsGet endpoint to query all contracts written for the given workflow by the given userId, and find the latest one by timestamp - this is obviously prone to latency and concurrency issues under load.
It seems to me that it would be a good idea to allow the caller to also specify a reference correlation identifier to be stored on the Contract record
Have I perhaps missed something else obvious?
Jul 10 2018 10:48 AM
Calling POST /api/v1/contracts should return back the ID of the contract, which you can use to query with GET.
Jul 10 2018 12:57 PM
You're right, thanks, it's the GatewayApi sample code which is discarding the contractid:
Replacing string.Empty with await msg.Content.ReadAsStringAsync() returns the newly allocated contract id as a raw string
Dec 04 2018 07:52 AM
For anyone interested, ABW 1.5 and hopefully onward now DO allow for asynchronous tie-ups of the Request and Response on the Messaging API : https://docs.microsoft.com/en-us/azure/blockchain/workbench/messages-overview
The user-supplied `requestId` that Contract and Contract Action requests accept is then echoed back on the ABW EventGrid (and I think also on the egress Service Bus topic), along with the assigned ContractId ContractAddress (Contract Creates) and ContractActionId / TransactionId (Contract Actions)