@@ -60,6 +60,12 @@ public class DBOS implements AutoCloseable {
6060
6161 private AlertHandler alertHandler ;
6262
63+ /**
64+ * Construct a new DBOS instance with the provided configuration.
65+ *
66+ * @param config the DBOS configuration; must not be null
67+ * @throws NullPointerException if config or required config fields are null
68+ */
6369 public DBOS (@ NonNull DBOSConfig config ) {
6470 Objects .requireNonNull (config , "DBOSConfig must not be null" );
6571 Objects .requireNonNull (config .appName (), "DBOSConfig.appName must not be null" );
@@ -72,6 +78,10 @@ public DBOS(@NonNull DBOSConfig config) {
7278 this .config = config ;
7379 }
7480
81+ /**
82+ * Close this DBOS instance and shut down all associated resources. This method delegates to
83+ * {@link #shutdown()}.
84+ */
7585 @ Override
7686 public void close () throws Exception {
7787 shutdown ();
@@ -98,6 +108,11 @@ public void close() throws Exception {
98108 }
99109 }
100110
111+ /**
112+ * Get the current DBOS version.
113+ *
114+ * @return the DBOS version string
115+ */
101116 public static String version () {
102117 return DBOS_VERSION ;
103118 }
@@ -592,9 +607,26 @@ public <E extends Exception> void runStep(
592607 * @param workflowId id of the workflow
593608 * @return A handle to the workflow
594609 */
610+ @ SuppressWarnings ("unchecked" )
595611 public <T , E extends Exception > @ NonNull WorkflowHandle <T , E > resumeWorkflow (
596612 @ NonNull String workflowId ) {
597- return ensureLaunched ("resumeWorkflow" ).resumeWorkflow (workflowId );
613+ var handles = resumeWorkflows (List .of (workflowId ));
614+ assert (handles .size () == 1 );
615+ return (WorkflowHandle <T , E >) handles .get (0 );
616+ }
617+
618+ /**
619+ * Resume multiple workflows starting from the step after the last complete step for each
620+ * workflow. This method allows bulk resumption of workflows that were previously interrupted or
621+ * failed.
622+ *
623+ * @param workflowIds a list of workflow IDs to resume; must not be null
624+ * @return A list of handles to the resumed workflows
625+ * @throws IllegalStateException if called before DBOS is launched
626+ */
627+ public @ NonNull List <WorkflowHandle <Object , Exception >> resumeWorkflows (
628+ @ NonNull List <String > workflowIds ) {
629+ return ensureLaunched ("resumeWorkflow" ).resumeWorkflows (workflowIds );
598630 }
599631
600632 /***
@@ -603,9 +635,69 @@ public <E extends Exception> void runStep(
603635 * current one) will not execute
604636 *
605637 * @param workflowId ID of the workflow to cancel
638+ * @throws IllegalStateException if called before DBOS is launched
606639 */
607640 public void cancelWorkflow (@ NonNull String workflowId ) {
608- ensureLaunched ("cancelWorkflow" ).cancelWorkflow (workflowId );
641+ cancelWorkflows (List .of (workflowId ));
642+ }
643+
644+ /**
645+ * Cancels multiple workflows. After this function is called, the next step (not the current one)
646+ * of each specified workflow will not execute.
647+ *
648+ * @param workflowIds a list of workflow IDs to cancel; must not be null
649+ * @throws IllegalStateException if called before DBOS is launched
650+ */
651+ public void cancelWorkflows (@ NonNull List <String > workflowIds ) {
652+ ensureLaunched ("cancelWorkflow" ).cancelWorkflows (workflowIds );
653+ }
654+
655+ /**
656+ * Delete a workflow from the system. This permanently removes the workflow and its associated
657+ * data from the database. Child workflows are preserved by default.
658+ *
659+ * @param workflowId ID of the workflow to delete; must not be null
660+ * @throws IllegalStateException if called before DBOS is launched
661+ */
662+ public void deleteWorkflow (@ NonNull String workflowId ) {
663+ deleteWorkflows (List .of (workflowId ), false );
664+ }
665+
666+ /**
667+ * Delete a workflow from the system. This permanently removes the workflow and its associated
668+ * data from the database.
669+ *
670+ * @param workflowId ID of the workflow to delete; must not be null
671+ * @param deleteChildren if true, also delete any child workflows; if false, preserve child
672+ * workflows
673+ * @throws IllegalStateException if called before DBOS is launched
674+ */
675+ public void deleteWorkflow (@ NonNull String workflowId , boolean deleteChildren ) {
676+ deleteWorkflows (List .of (workflowId ), deleteChildren );
677+ }
678+
679+ /**
680+ * Delete multiple workflows from the system. This permanently removes the workflows and their
681+ * associated data from the database. Child workflows are preserved by default.
682+ *
683+ * @param workflowIds a list of workflow IDs to delete; must not be null
684+ * @throws IllegalStateException if called before DBOS is launched
685+ */
686+ public void deleteWorkflows (@ NonNull List <String > workflowIds ) {
687+ deleteWorkflows (workflowIds , false );
688+ }
689+
690+ /**
691+ * Delete multiple workflows from the system. This permanently removes the workflows and their
692+ * associated data from the database.
693+ *
694+ * @param workflowIds a list of workflow IDs to delete; must not be null
695+ * @param deleteChildren if true, also delete any child workflows; if false, preserve child
696+ * workflows
697+ * @throws IllegalStateException if called before DBOS is launched
698+ */
699+ public void deleteWorkflows (@ NonNull List <String > workflowIds , boolean deleteChildren ) {
700+ ensureLaunched ("deleteWorkflows" ).deleteWorkflows (workflowIds , deleteChildren );
609701 }
610702
611703 /**
@@ -639,28 +731,6 @@ public void cancelWorkflow(@NonNull String workflowId) {
639731 return forkWorkflow (workflowId , startStep , new ForkOptions ());
640732 }
641733
642- /**
643- * Deletes a workflow from the system. Does not delete child workflows.
644- *
645- * @param workflowId the unique identifier of the workflow to delete. Must not be null.
646- * @throws IllegalArgumentException if workflowId is null
647- */
648- public void deleteWorkflow (@ NonNull String workflowId ) {
649- deleteWorkflow (workflowId , false );
650- }
651-
652- /**
653- * Deletes a workflow and optionally its child workflows from the system.
654- *
655- * @param workflowId the unique identifier of the workflow to delete. Must not be null.
656- * @param deleteChildren if true, also deletes all child workflows associated with the specified
657- * workflow; if false, only deletes the specified workflow
658- * @throws IllegalArgumentException if workflowId is null
659- */
660- public void deleteWorkflow (@ NonNull String workflowId , boolean deleteChildren ) {
661- ensureLaunched ("deleteWorkflow" ).deleteWorkflow (workflowId , deleteChildren );
662- }
663-
664734 /**
665735 * Retrieve a handle to a workflow, given its ID. Note that a handle is always returned, whether
666736 * the workflow exists or not; getStatus() can be used to tell the difference
0 commit comments