Giter Club home page Giter Club logo

temporal's Introduction

temporal

Clojars Project

temporal.io (Uber Cadence successor) in Clojure.

This is a library to help using the temporal java SDK by introducing helpers macros and functions.

Installation

net.clojars.nha/temporal

The versionning is comprised of the temporal java version used followed by the number of commits in this projects. For example version 1.5.0.7 of nha/temporal means the temporal java version used is 1.5.0 and there are 7 commits in this repository.

Usage

Status: Alpha

If you must, here is the greetings sample translated:

(ns your.ns
  (:require [nha.temporal :as t])
  (:import [java.time Duration]))

(def task-queue "HelloActivityTaskQueue")
(def workflow-id "HelloActivityWorkflow")

(t/def-workflow-interface
  GreetingWorkflow
  (^String getGreeting [param-not-this] "say something yo"))

(t/def-activity-interface
  GreetingActivities
  (composeGreeting [^String greeting ^String n]))

(defrecord MyWorkflowImpl []
  GreetingWorkflow
  (getGreeting [this s]
    (let [actv (t/activity-stub
                GreetingActivities
                (t/activity-opts {:start-to-close-timeout (Duration/ofSeconds 2)}))]
      (.composeGreeting actv "HELLO " s))))

(defrecord MyActivityImpl []
  GreetingActivities
  (composeGreeting [this greetings n]
    (str greetings n)))

(let [{:keys [client] :as component} (-> (t/component task-queue)
                                         (t/start-component [MyWorkflowImpl] [(MyActivityImpl.)]))]
  (let [^GreetingWorkflow workflow (t/network-stub client GreetingWorkflow (t/workflow-options task-queue workflow-id))]
    ;; this will print "HELLO WORLD"
    (println (.getGreeting workflow "WORLD")))
  (t/stop-component component))

Development

Start a REPL with:

$ clojure -M:dev

Run the project's tests:

$ clojure -M:test

Deploy (on the main branch):

$ export CLOJARS_USERNAME=username
$ export CLOJARS_PASSWORD=clojars-token
$ export CI=true # optional, if using temporal-testing
$ clj -T:build ci && clj -T:build install && clj -T:build deploy

License

Copyright © 2022 Nicolas.ha

temporal's People

Contributors

nha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

temporal's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.