Skip to content

Commit 7d0827f

Browse files
devhawkCopilot
andcommitted
improve dbos client java docs
Co-authored-by: Copilot <copilot@github.com>
1 parent 045452f commit 7d0827f

1 file changed

Lines changed: 45 additions & 19 deletions

File tree

transact/src/main/java/dev/dbos/transact/DBOSClient.java

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,36 @@ public void close() {
161161
}
162162

163163
/**
164-
* Options for enqueuing a workflow. It is necessary to specify the class and name of the workflow
165-
* to enqueue, as well as the queue to use. Other options, such as the workflow ID, queue options,
166-
* and app version, are optional, and should be set with `with` functions.
164+
* Options for enqueuing a workflow instance for execution.
165+
*
166+
* <p>This record encapsulates all configuration required to enqueue a workflow, including:
167+
*
168+
* <ul>
169+
* <li>Workflow name and (optionally) class and instance name
170+
* <li>Target queue and queue-related options (priority, partitioning, deduplication, delay)
171+
* <li>Workflow idempotency and versioning
172+
* <li>Timeout and deadline management
173+
* <li>Serialization strategy for workflow arguments
174+
* </ul>
175+
*
176+
* <p>Required fields: {@code workflowName}, {@code queueName}. All other fields are optional and
177+
* can be set using the provided {@code with} methods.
178+
*
179+
* @param workflowName The name of the workflow function to enqueue. Required.
180+
* @param className The Java class containing the workflow function. Optional.
181+
* @param instanceName The instance name for object-based workflows. Optional.
182+
* @param queueName The name of the queue to enqueue the workflow to. Required.
183+
* @param workflowId The idempotency key for the workflow instance. Optional; if not set, a random
184+
* UUID will be generated.
185+
* @param appVersion The application version to target for execution. Optional.
186+
* @param timeout The maximum duration the workflow may run before being canceled. Optional.
187+
* @param deadline The absolute time by which the workflow must start or complete. Optional.
188+
* @param deduplicationId An optional ID to prevent duplicate enqueued workflows. Optional.
189+
* @param priority The priority to assign if the queue supports prioritization. Optional.
190+
* @param queuePartitionKey The partition key for distributing workflows across queue partitions.
191+
* Optional.
192+
* @param delay The delay before the workflow starts executing. Optional.
193+
* @param serialization The serialization strategy for workflow arguments. Optional.
167194
*/
168195
public record EnqueueOptions(
169196
@NonNull String workflowName,
@@ -1004,28 +1031,27 @@ public void applySchedules(@NonNull WorkflowSchedule... schedules) {
10041031
systemDatabase.applySchedules(Arrays.asList(schedules));
10051032
}
10061033

1007-
// /**
1008-
// * Enqueue all executions of a schedule that would have run between {@code start} (exclusive)
1009-
// and
1010-
// * {@code end} (exclusive).
1011-
// *
1012-
// * @param scheduleName name of an existing schedule
1013-
// * @param start start of the backfill window (exclusive)
1014-
// * @param end end of the backfill window (exclusive)
1015-
// * @return handles to the enqueued executions
1016-
// */
1034+
/**
1035+
* Enqueue all executions of a schedule that would have run between {@code start} (exclusive) and
1036+
* {@code end} (exclusive).
1037+
*
1038+
* @param scheduleName name of an existing schedule
1039+
* @param start start of the backfill window (exclusive)
1040+
* @param end end of the backfill window (exclusive)
1041+
* @return handles to the enqueued executions
1042+
*/
10171043
public @NonNull List<WorkflowHandle<Object, Exception>> backfillSchedule(
10181044
@NonNull String scheduleName, @NonNull Instant start, @NonNull Instant end) {
10191045
var ids = DBOSExecutor.backfillSchedule(scheduleName, start, end, systemDatabase, serializer);
10201046
return ids.stream().<WorkflowHandle<Object, Exception>>map(this::retrieveWorkflow).toList();
10211047
}
10221048

1023-
// /**
1024-
// * Immediately enqueue the scheduled workflow at the current time.
1025-
// *
1026-
// * @param scheduleName name of an existing schedule
1027-
// * @return handle to the enqueued execution
1028-
// */
1049+
/**
1050+
* Immediately enqueue the scheduled workflow at the current time.
1051+
*
1052+
* @param scheduleName name of an existing schedule
1053+
* @return handle to the enqueued execution
1054+
*/
10291055
public <T, E extends Exception> @NonNull WorkflowHandle<T, E> triggerSchedule(
10301056
@NonNull String scheduleName) {
10311057
var id = DBOSExecutor.triggerSchedule(scheduleName, systemDatabase, serializer);

0 commit comments

Comments
 (0)