Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/temporal/activity.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ along with the Activity Task for the next retry attempt and can be extracted by
(log/trace "get-heartbeat-details:" v)
v)))

(defn get-info
"Returns information about the Activity execution"
[]
(a/get-info))

(defn- complete-invoke
[activity result]
(log/trace activity "completed with" (count result) "bytes")
Expand Down
7 changes: 4 additions & 3 deletions src/temporal/internal/activity.clj
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@
:activity-type (.getActivityType d)}))

(defn get-info []
(-> (Activity/getExecutionContext)
(.getInfo)
(d/datafy)))
(->> (Activity/getExecutionContext)
(.getInfo)
(d/datafy)
(into {})))

(defn get-annotation
^String [x]
Expand Down
26 changes: 26 additions & 0 deletions test/temporal/test/activity_info.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;; Copyright © Manetu, Inc. All rights reserved

(ns temporal.test.activity-info
(:require [clojure.test :refer :all]
[temporal.client.core :as c]
[temporal.workflow :refer [defworkflow]]
[temporal.activity :refer [defactivity] :as a]
[temporal.test.utils :as t]))

(use-fixtures :once t/wrap-service)

(defactivity getinfo-activity
[ctx args]
(a/get-info))

(defworkflow getinfo-workflow
[args]
@(a/invoke getinfo-activity args))

(deftest the-test
(testing "Verifies that we can retrieve our activity-id"
(let [workflow (t/create-workflow getinfo-workflow)]
(c/start workflow {})
(let [{:keys [activity-id]} @(c/get-result workflow)]
(is (some? activity-id))))))