{
  "id": 18136796,
  "title": "Two coroutines, one journal: a Restate restart demo",
  "url": "https://urgent.news/2026/11/04/two-coroutines-one-journal-a-restate-restart-demo",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-04T15:17:26.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/panditshivam/two-coroutines-one-journal-a-restate-restart-demo-46fp"
  },
  "original_language": "en",
  "account": "The demonstration of Restate's new durable coroutines involved two separate routines, each with its own steps. An interruption occurred in the middle of the process, and the file was used to ensure the executed effects were easily inspectable. The routines utilized generator-based coroutines provided by Restate, allowing the scheduler to control when the routines advanced. I/O operations could overlap during completion, while the order of completion was recorded for recovery purposes.\n\nThe Restate Server version 1.8.1, Node.js 22.22.1, and the corresponding JavaScript packages at version 1.18.2 were used in the demo. The service wrote a short line during preparation, waited on a durable timer, and then wrote a finish line. The value returned by the generator traveled through the local variable and into the final result.\n\nThe service was implemented in a file named \"service.mjs\" using the following dependencies:\n\n```javascript\nnpm install --save-exact @restatedev/restate-sdk@1.18.2 @restatedev/restate-sdk-gen@1.18.2\n```\n\nThe service code included the creation of two lane functions (`prepare-a` and `prepare-b`) that returned generators. These generators handled the preparation and finish steps for each routine, writing the corresponding lines to a file named \"effects.log\". The `sleep` function was used to introduce an 8-second delay between the preparation and finish steps, allowing for an interruption window.\n\nThe service was configured in a \"restate.toml\" file, which specified the Restate server settings, including the binding addresses and memory size. The server was started using Node.js with the service file (\"service.mjs\") as the entry point.\n\nTo invoke the service, a request was made to the server's ingress endpoint at \"http://127.0.0.1:18080/CoroutineDemo/run\" with a JSON null body. Directly calling the Node.js endpoint would skip the server that owned the journal. After the first invocation finished without interruption, the results were consistent, with each preparation and finish line written once to the file.\n\nFor the restart trial, an interruption was introduced in the middle of the process. The service was able to handle the interruption, and the file was used to verify that the executed effects remained intact.",
  "summary": "Both preparation steps had finished when I stopped the Node process. The Restate server stayed running. After I started the service again, the pending invocation returned [\"A\", \"B\"] , and the preparation writes were still present only once each. This is the small recovery demo I wanted for Restate's new durable coroutines: two routines with their own steps, an interruption in the middle, and a…",
  "key_points": [
    "Two coroutines, prepare-a and prepare-b, each with generator-based steps",
    "Interruption occurred mid-process, file verified executed effects",
    "Service implemented in service.mjs with dependencies @restatedev/restate-sdk"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}