Calling Kotlin suspending methods in Temporal Workflow or Activities

Hello there - I’m looking into temporal to implement something quite simple:

  • Every day or so, query an API to retrieve a list of result
  • For each result, start a new “update” workflow
  • This update workflow might also be triggered manually to force a refresh of a specific item

I have most of the code ready except for the actually running it part and I was thinking of using temporal for this, but I’m a little confused about the asynchronous part. I’ve seen a bunch of examples where people simple use runBlocking to call a suspending function from a sync activity method, but this doesn’t seem great to me. Is there an example of an async workflow using kotlin somewhere?

Basically, I’m looking for answers to the following question:

  • Can a @WorkflowMethod be marked as suspend? I get an error at runtime when I do, something about serialization.
  • Same question for @ActivityMethod. It seems to work when I mark it as suspend but I still need something at the workflow level to be able to call it.

Instinctively what I wanna do is keep my WorkflowMethod and and ActivityMethod non-suspending and wrap them into CoroutineScope(...).launch(...) and use ActivityCompletionClient when it’s done. Is there something that I’m missing that would negatively impact my workflow runs?

Thanks!