Equivalent of "transaction scope" with Digital Twins SDK

Helena Foo 66 Reputation points
2022-11-07T11:13:50.353+00:00

I'm using the Digital Twins SDK and am wondering if there is anything like a transaction scope, or thoughts on how to implement that type of functionality? If, let's say, I am in a process of uploading 100 twins and 1000 relationships, something goes wrong in the middle of it and I would rather that the whole thing failed than to have managed uploading only a fraction of the entire set.

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
222 questions
0 comments No comments
{count} votes

Accepted answer
  1. Matthijs van der Veer 4,376 Reputation points MVP
    2022-11-07T13:58:01.79+00:00

    There is no such functionality in the SDK. Implementing it yourself would most likely mean keeping a list of twins/relationships added successfully and removing them if one addition fails. If you start with removing the added relationships first, you should have no trouble reverting to the initial state. But when you start reverting thousands of twins/relationships, this could become quite time-consuming.

    One new feature to look into would be data importing from the CLI. There is a new feature where you can create a "job". That might support transactions, but the documentation is extremely limited, and I haven't tried it yet. The idea is that you upload a file to blob storage, containing models, twins and relationships. You give your ADT instance read/write rights on that container and start a job through the CLI. The job will then place an output file next to the uploaded input file with the results.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful