You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The download first goes to a unique sibling `.part` file. Only a complete transfer atomically replaces `current-model.bin`. Failure removes the partial file and preserves the existing destination. A filesystem that cannot perform atomic replacement is rejected explicitly.
The taskinput and output are strings. No task-runner file integration is required.
162
+
`@WorkerTask` names the `SIMPLE`task, the unannotated POJO receives the full resolved input map, `@WorkflowInstanceIdInputParam` supplies the workflow context required by `FileClient`, and `@OutputParam` maps the returned handle to `output.document`. Thrown exceptions become failed task results.
177
163
178
-
## Annotated worker example
164
+
Register already-constructed worker instances so normal constructor injection continues to work:
The annotation value must exactly match both the workflow task's `name` and a registered task definition. The task input and output remain plain strings; no task-runner file integration is required. Implement the lower-level `Worker` interface only when the method-binding model is insufficient and direct access to the full `Task` or `TaskResult` is necessary.
172
+
203
173
## Retry and security behavior
204
174
205
175
- A new signed URL is requested before every retry.
Copy file name to clipboardExpand all lines: examples/file-storage/media-transcoder/README.md
+60-4Lines changed: 60 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,71 @@ This example passes videos, thumbnails, and a JSON manifest through a workflow a
6
6
7
7
| Case | Source |
8
8
|---|---|
9
-
| Upload a caller-owned `InputStream` with required filename and content type |[`UploadPrimaryVideoWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/UploadPrimaryVideoWorker.java)|
10
-
| Download a handle, process the file, and upload a `Path`from an annotated worker |[`TranscodeWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/TranscodeWorker.java)|
11
-
| Download and upload from a raw `Worker`, including task ID metadata |[`ThumbnailWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/ThumbnailWorker.java)|
12
-
| Read metadata and download before producing another handle |[`ManifestWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/ManifestWorker.java)|
9
+
| Upload a caller-owned `InputStream` with required filename and content type |Annotated [`UploadPrimaryVideoWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/UploadPrimaryVideoWorker.java)|
10
+
| Download a handle, process the file, and upload a `Path`| Annotated[`TranscodeWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/TranscodeWorker.java)|
11
+
| Download and upload a second derived file in a parallel workflow branch | Annotated[`ThumbnailWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/ThumbnailWorker.java)|
12
+
| Read metadata and download before producing another handle |Annotated [`ManifestWorker.java`](src/main/java/io/conductor/example/mediatranscoder/workers/ManifestWorker.java)|
13
13
| Every public `FileClient` overload in small copyable methods |[`FileClientUsage.java`](src/main/java/io/conductor/example/mediatranscoder/FileClientUsage.java)|
14
14
| Pass only handle strings between sequential and parallel tasks |[`media_transcode.json`](src/main/resources/workflow/media_transcode.json)|
15
15
16
16
Large `Path` uploads use the same call shown in the workers. `FileClient` automatically selects multipart for S3 and Azure when the configured threshold is exceeded; GCS and local storage use one request.
17
17
18
+
## Annotated worker pattern
19
+
20
+
Every worker follows the same four-part pattern from [`WorkerTask.java`](../../../conductor-client/src/main/java/com/netflix/conductor/sdk/workflow/task/WorkerTask.java):
21
+
22
+
1. Inject `FileClient` into a plain Java object.
23
+
2. Put the workflow task name on a method with `@WorkerTask`.
24
+
3. Receive the resolved task input as a typed object and workflow context with `@WorkflowInstanceIdInputParam`.
25
+
4. Return the handle string and use `@OutputParam` to name the task output.
26
+
27
+
```java
28
+
publicfinalclassTranscodeWorker {
29
+
privatefinalFileClient files;
30
+
31
+
publicTranscodeWorker(FileClientfiles) {
32
+
this.files = files;
33
+
}
34
+
35
+
publicstaticclassTranscodeInput {
36
+
publicString primary_video;
37
+
publicString resolution;
38
+
}
39
+
40
+
@WorkerTask("transcode_video")
41
+
public @OutputParam("output_file") Stringtranscode(
The annotation value must exactly match the `name` of the corresponding `SIMPLE` task and its registered task definition. This application checks all four task definitions before starting the workflow, so a missing worker definition cannot silently leave the workflow queued.
Copy file name to clipboardExpand all lines: examples/file-storage/media-transcoder/src/main/java/io/conductor/example/mediatranscoder/MediaTranscoderApp.java
Copy file name to clipboardExpand all lines: examples/file-storage/media-transcoder/src/main/java/io/conductor/example/mediatranscoder/workers/ManifestWorker.java
0 commit comments