temporalio / temporalio/sdk-java
Scala module
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 433
- Fork
- 249
- Merge medio
- 5g 6h
- PR unite (30g)
- 26
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando i casi di interoperabilità elencati per WorkflowClient.start/execute e Workflow.await, quindi valuta la serializzazione di Scala Option e delle collection, oltre al supporto per Scala Duration. L’esempio Java di riferimento a un metodo e gli snippet di wrapper esistenti definiscono requisiti aggiuntivi. Il lavoro è completo quando un modulo Scala coerente copre le esigenze elencate di interoperabilità e conversione dei tipi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, scala
- Ambito
- developer-experience
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100