Repository navigation
Commit 6e846a6
authored
feat!: unify the durable task client into dapr-sdk-workflows (#1800)
* feat!: unify the durable task client into dapr-sdk-workflows
The durabletask-client module duplicated much of the workflows API across
a module boundary, which forced an adapter layer and a second copy of a
dozen types. Fold it into dapr-sdk-workflows and remove it.
The absorbed types move from io.dapr.durabletask.* to
io.dapr.workflows.task.*, split into client, worker, history, exception,
serialization and internal subpackages. Twelve duplicate type-pairs
collapse to one each. Most significantly TaskOrchestrationContext becomes
WorkflowContext and is implemented directly by the replay executor, so
the DefaultWorkflowContext adapter and the converter and wrapper classes
it required are gone.
Two behaviour changes come with the merge:
- The runtime's default executor is a virtual-thread-per-task executor on
Java 21+, resolved reflectively so the module still compiles at
release 17 and never names a Java 21 API. WorkflowRuntime now tracks
whether it created the executor and no longer shuts down one supplied
by the caller, so handing it a framework-managed executor is safe.
- WorkflowRuntimeStatus absorbs the protobuf mapping and gains STALLED,
which the deleted converter rejected with an exception.
isCausedBy maps the exception names that shipped under io.dapr.durabletask
onto their current types, so a workflow started before the upgrade still
resolves its failure type after it.
The CI job that built durabletask-client now installs its reactor
dependencies first: unlike the old module, the merged one depends on the
sibling dapr-sdk and cannot be built standalone.
BREAKING CHANGE: io.dapr:durabletask-client is removed and its classes
ship in io.dapr:dapr-sdk-workflows. Types move from io.dapr.durabletask.*
to io.dapr.workflows.task.*, seven types are renamed, and the four
@deprecated(forRemoval) DaprWorkflowClient methods together with
WorkflowInstanceStatus are removed. See MIGRATION.md for the full type
mapping and for what it means for workflows that are already running.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* docs: add a migration guide for the unified workflows module
Folding durabletask-client into dapr-sdk-workflows is a breaking change,
so document it where an upgrader will look: MIGRATION.md carries the full
old-to-new type mapping, the renames, the removed API, the behaviour
changes that are invisible to the compiler, and a tested rewrite script
for the mechanical import changes.
The section on workflows that are already running is the important one.
The error type is persisted into workflow history, so a workflow started
before the upgrade carries the old exception names; the guide explains
what the SDK maps for you and what it does not.
Link the guide from README.md and SUPPORT.md, drop durabletask-client
from the module lists in both, and record that Java 21 is recommended for
workflows now that the default executor uses virtual threads there.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* refactor: narrow the workflow exception constructors back to package-private
Splitting the folded durable task types into subpackages moved the
executor away from the exceptions it constructs, and the visibility was
widened to compensate. It was widened further than the split required:
every constructor on both classes became public where only the two the
executor actually calls needed to be.
Restore the rest to package-private, matching what they were before the
merge. The two that stay public are the ones the executor constructs from
io.dapr.workflows.task.internal, and their javadoc now says so accurately
— the previous note claimed a sibling-package caller for members that
have none.
No test used any of these constructors, and no behaviour changes.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* docs: name the SDK line that carries the workflows module unification
State in SUPPORT.md that durabletask-client is folded into dapr-sdk-workflows
in 1.19.x, so a user reading the version table knows which upgrade requires the
source changes described in MIGRATION.md.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* test: cover the durable task sources folded into dapr-sdk-workflows
The durabletask-client module had no jacoco configuration, so none of its
sources were measured. Folding them into dapr-sdk-workflows brings them into
the report, where the untested ones stood out: the activity and orchestration
runners had no tests at all.
Adds unit tests for the runners, the orchestration context operations that fan
tasks in and out, the gRPC client management operations, the client convenience
overloads and their cross-app guard, and the argument checks on the helpers,
converters, factories and builders. Line coverage for the module goes from 70%
to 86%, so the temporary 60% jacoco threshold this branch introduced is removed
and the module is back on the repo-wide 80% default.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* fix: reject a null workflow status and cover the executor ownership decision
WorkflowRuntimeStatus.fromProtobuf threw NullPointerException on a null
status, where the converter it replaced threw IllegalArgumentException with a
message and had a test for it. Restores that behaviour.
WorkflowRuntimeBuilder decides whether the runtime owns the executor it was
built with, but the lifecycle tests passed that flag straight to the
WorkflowRuntime constructor, so nothing pinned the decision itself. Adds two
tests that go through build(), one per outcome; inverting the decision fails
both.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* fix: exclude generated durabletask protobuf classes from SpotBugs
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* docs: note that the unified workflows module ships in 1.20.x
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* fix: wait for in-flight work on a caller-supplied executor before close returns
close() does not shut down an executor the caller supplied, so it also
did not wait for the orchestrations and activities submitted to it. The
runtime could then close the sidecar channel while they still needed it.
The worker now counts the runners it submits and close() waits up to 60
seconds for them, without shutting the executor down.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* fix: reject a non-finite retry backoff coefficient
NaN passed the 'less than 1.0' check because every comparison with NaN
is false, and the executor then turned it into a zero retry delay. The
constructor and the builder setter now reject NaN and infinity.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* fix: drop a work item that arrives after close starts draining
The worker thread can already hold a work item from the stream when
close() runs. It then submitted that item after the drain had returned,
so the item ran against a channel that was about to close. The submit
now checks for shutdown under the same lock as the in-flight count and
drops the item; the sidecar redelivers it because it was never completed.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
* test: cover DurableTaskGrpcClient option mapping, sidecar errors and TLS failures
Covers the empty orchestrator name check, version and start time
mapping, terminate output, the DEADLINE_EXCEEDED to TimeoutException
mapping and rethrow of other errors for waitForInstanceStart,
waitForInstanceCompletion and purgeInstances, and the errors raised
when TLS certificate files cannot be read.
Signed-off-by: Javier Aliaga <javier@diagrid.io>
---------
Signed-off-by: Javier Aliaga <javier@diagrid.io>1 parent 3bf68c9 commit 6e846a6
161 files changed
Lines changed: 5633 additions & 4408 deletions
File tree
- .github/workflows
- dapr-spring/dapr-spring-boot-observation/src
- main/java/io/dapr/spring/observation/client
- test/java/io/dapr/spring/observation/client
- durabletask-client
- src/main/java/io/dapr/durabletask
- examples/src/main/java/io/dapr/examples
- unittesting
- workflows
- childworkflow
- compensation
- faninout
- historypropagation
- multiapp
- sdk-bom
- sdk-tests/src/test/java/io/dapr/it/testcontainers/workflows
- sdk-workflows
- src
- main/java/io/dapr/workflows
- client
- runtime
- task
- client
- exception
- history
- internal
- runner
- interruption
- orchestration
- serialization
- worker
- test/java/io/dapr/workflows
- client
- runtime
- task
- client
- exception
- history
- internal
- runner
- orchestration
- serialization
- spring-boot-examples/workflows
- event-workflow/src/main/java/io/dapr/springboot/examples/eventworkflow
- multi-app/orchestrator/src/main/java/io/dapr/springboot/examples/orchestrator
- patterns/src/main/java/io/dapr/springboot/examples/wfp
- fanoutin
- historypropagation
- spring-boot-sdk-tests/src/test/java/io/dapr/it/springboot/testcontainers/workflows
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| |||
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
132 | | - | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
194 | 203 | | |
195 | 204 | | |
196 | 205 | | |
197 | | - | |
| 206 | + | |
198 | 207 | | |
199 | 208 | | |
200 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
334 | 333 | | |
335 | 334 | | |
336 | 335 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | 336 | | |
342 | 337 | | |
343 | 338 | | |
| |||
0 commit comments