temporalio / temporalio/sdk-java
Scala module
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
I'll go with a top-to-bottom approach with the things I encountered, and how I tried to solve them in my project.
- WorkflowClient
- WorkflowClient.start with
io.temporal.workflow.Functions.Funcarguments - WorkflowClient.start with
io.temporal.workflow.Functions.Procarguments - WorkflowClient.execute with
io.temporal.workflow.Functions.Funcarguments - WorkflowClient.execute with
io.temporal.workflow.Functions.Procarguments
Solved this by writing some small wrappers. I don't think this is the way, but the code inside might be useful. These are the only type of functions I needed, didn't convert them all (e.g the ones that take more arguments)
def startAsync(f: T => Unit, arg: T): WorkflowExecution = {
WorkflowClient.start(new Proc1[T]() {
override def apply(j: T): Unit = f(j)
}, t)
}
def executeAsyncVoid(f: () => Unit): Future[Unit] = {
import scala.compat.java8.FutureConverters._
WorkflowClient.execute(new Proc {
override def apply(): Unit = f()
}).toScala.map[Unit](_ => ())
}
def executeAsync[T](f: () => T): Future[T] = {
import scala.compat.java8.FutureConverters._
WorkflowClient.execute(new Func[T] {
override def apply(): T = f()
}).toScala
}
- Scala specific object types serialization/deserialization
- Option
- List (basically all Scala collections)
We can probably solve this when Jackson will be integrated in java-sdk
- Workflow.await requiring a Supplier, instead of passing a function reference
Again, solved in a simple wrapper
def await(duration: Duration, f: () => Boolean) {
Workflow.await(duration, new Supplier[lang.Boolean] {
override def get(): lang.Boolean = f()
})
}
- Java way of referencing some method (not sure how this syntax it's called in Java)
(Mostly the same as 1. but I put it in a different issue as it's a little bit a different problem)
WorkflowClient.execute(workflow::getGreeting, "World") -> notice the double colon
- Accepting Scala Duration type
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the listed WorkflowClient.start/execute and Workflow.await interop cases, then assess Scala Option and collection serialization and Scala Duration support. The Java method-reference example and existing wrapper snippets define additional requirements. Done means a coherent Scala module addresses the listed interop and type-conversion needs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100