@@ -803,11 +803,12 @@ AND status NOT IN (?, ?)
803803 }
804804 }
805805
806- void resumeWorkflows (List <String > workflowIds ) throws SQLException {
806+ void resumeWorkflows (List <String > workflowIds , String queueName ) throws SQLException {
807807 List <String > filtered = filterNullsAndBlanks (workflowIds );
808808 if (filtered .isEmpty ()) {
809809 return ;
810810 }
811+
811812 String sql =
812813 """
813814 UPDATE "%s".workflow_status
@@ -827,7 +828,7 @@ AND status NOT IN (?, ?)
827828 Array array = conn .createArrayOf ("text" , filtered .toArray (String []::new ));
828829 try {
829830 stmt .setString (1 , WorkflowState .ENQUEUED .name ());
830- stmt .setString (2 , Constants .DBOS_INTERNAL_QUEUE );
831+ stmt .setString (2 , Objects . requireNonNullElse ( queueName , Constants .DBOS_INTERNAL_QUEUE ) );
831832 stmt .setArray (3 , array );
832833 stmt .setString (4 , WorkflowState .SUCCESS .name ());
833834 stmt .setString (5 , WorkflowState .ERROR .name ());
@@ -915,14 +916,11 @@ String forkWorkflow(String originalWorkflowId, int startStep, ForkOptions option
915916 }
916917
917918 String forkedWorkflowId =
918- options .forkedWorkflowId () == null
919- ? UUID .randomUUID ().toString ()
920- : options .forkedWorkflowId ();
919+ Objects .requireNonNullElseGet (
920+ options .forkedWorkflowId (), () -> UUID .randomUUID ().toString ());
921921
922922 logger .debug ("forkWorkflow Original id {} forked id {}" , originalWorkflowId , forkedWorkflowId );
923923
924- String applicationVersion = options .applicationVersion ();
925-
926924 var timeout = Objects .requireNonNullElseGet (options .timeout (), Timeout ::inherit );
927925 Long timeoutMS = null ;
928926 if (timeout instanceof Timeout .Inherit ) {
@@ -941,8 +939,10 @@ String forkWorkflow(String originalWorkflowId, int startStep, ForkOptions option
941939 originalWorkflowId ,
942940 forkedWorkflowId ,
943941 status ,
944- applicationVersion ,
942+ options . applicationVersion () ,
945943 timeoutMS ,
944+ options .queueName (),
945+ options .queuePartitionKey (),
946946 this .schema ,
947947 this .serializer );
948948
@@ -969,6 +969,8 @@ private static void insertForkedWorkflowStatus(
969969 WorkflowStatus originalStatus ,
970970 String applicationVersion ,
971971 Long timeoutMS ,
972+ String queueName ,
973+ String queuePartitionKey ,
972974 String schema ,
973975 DBOSSerializer serializer )
974976 throws SQLException {
@@ -978,8 +980,9 @@ private static void insertForkedWorkflowStatus(
978980 """
979981 INSERT INTO "%s".workflow_status (
980982 workflow_uuid, status, name, class_name, config_name, application_version, application_id,
981- authenticated_user, authenticated_roles, assumed_role, queue_name, inputs, workflow_timeout_ms, forked_from, serialization
982- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
983+ authenticated_user, authenticated_roles, assumed_role, queue_name, queue_partition_key, inputs,
984+ workflow_timeout_ms, forked_from, serialization
985+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
983986 """
984987 .formatted (schema );
985988
@@ -998,15 +1001,16 @@ private static void insertForkedWorkflowStatus(
9981001 ? null
9991002 : JSONUtil .toJson (originalStatus .authenticatedRoles ()));
10001003 stmt .setString (10 , originalStatus .assumedRole ());
1001- stmt .setString (11 , Constants .DBOS_INTERNAL_QUEUE );
1004+ stmt .setString (11 , Objects .requireNonNullElse (queueName , Constants .DBOS_INTERNAL_QUEUE ));
1005+ stmt .setString (12 , queuePartitionKey );
10021006 stmt .setString (
1003- 12 ,
1007+ 13 ,
10041008 SerializationUtil .serializeArgs (
10051009 originalStatus .input (), null , originalStatus .serialization (), serializer )
10061010 .serializedValue ());
1007- stmt .setObject (13 , timeoutMS );
1008- stmt .setString (14 , originalWorkflowId );
1009- stmt .setString (15 , originalStatus .serialization ());
1011+ stmt .setObject (14 , timeoutMS );
1012+ stmt .setString (15 , originalWorkflowId );
1013+ stmt .setString (16 , originalStatus .serialization ());
10101014
10111015 stmt .executeUpdate ();
10121016 }
0 commit comments