@@ -86,6 +86,7 @@ public static final class Builder {
86
86
private SlotSupplier <WorkflowSlotInfo > workflowSlotSupplier ;
87
87
private SlotSupplier <ActivitySlotInfo > activitySlotSupplier ;
88
88
private SlotSupplier <LocalActivitySlotInfo > localActivitySlotSupplier ;
89
+ private String identity ;
89
90
90
91
private Builder () {}
91
92
@@ -416,6 +417,12 @@ public void setLocalActivitySlotSupplier(
416
417
this .localActivitySlotSupplier = localActivitySlotSupplier ;
417
418
}
418
419
420
+ /** Override identity of the worker primary specified in a WorkflowClient options. */
421
+ public Builder setIdentity (String identity ) {
422
+ this .identity = identity ;
423
+ return this ;
424
+ }
425
+
419
426
public WorkerOptions build () {
420
427
return new WorkerOptions (
421
428
maxWorkerActivitiesPerSecond ,
@@ -436,7 +443,8 @@ public WorkerOptions build() {
436
443
disableEagerExecution ,
437
444
useBuildIdForVersioning ,
438
445
buildId ,
439
- stickyTaskQueueDrainTimeout );
446
+ stickyTaskQueueDrainTimeout ,
447
+ identity );
440
448
}
441
449
442
450
public WorkerOptions validateAndBuildWithDefaults () {
@@ -525,7 +533,8 @@ public WorkerOptions validateAndBuildWithDefaults() {
525
533
buildId ,
526
534
stickyTaskQueueDrainTimeout == null
527
535
? DEFAULT_STICKY_TASK_QUEUE_DRAIN_TIMEOUT
528
- : stickyTaskQueueDrainTimeout );
536
+ : stickyTaskQueueDrainTimeout ,
537
+ identity );
529
538
}
530
539
}
531
540
@@ -548,6 +557,7 @@ public WorkerOptions validateAndBuildWithDefaults() {
548
557
private final boolean useBuildIdForVersioning ;
549
558
private final String buildId ;
550
559
private final Duration stickyTaskQueueDrainTimeout ;
560
+ private final String identity ;
551
561
552
562
private WorkerOptions (
553
563
double maxWorkerActivitiesPerSecond ,
@@ -568,7 +578,8 @@ private WorkerOptions(
568
578
boolean disableEagerExecution ,
569
579
boolean useBuildIdForVersioning ,
570
580
String buildId ,
571
- Duration stickyTaskQueueDrainTimeout ) {
581
+ Duration stickyTaskQueueDrainTimeout ,
582
+ String identity ) {
572
583
this .maxWorkerActivitiesPerSecond = maxWorkerActivitiesPerSecond ;
573
584
this .maxConcurrentActivityExecutionSize = maxConcurrentActivityExecutionSize ;
574
585
this .maxConcurrentWorkflowTaskExecutionSize = maxConcurrentWorkflowTaskExecutionSize ;
@@ -588,6 +599,7 @@ private WorkerOptions(
588
599
this .useBuildIdForVersioning = useBuildIdForVersioning ;
589
600
this .buildId = buildId ;
590
601
this .stickyTaskQueueDrainTimeout = stickyTaskQueueDrainTimeout ;
602
+ this .identity = identity ;
591
603
}
592
604
593
605
public double getMaxWorkerActivitiesPerSecond () {
@@ -683,6 +695,11 @@ public SlotSupplier<LocalActivitySlotInfo> getLocalActivitySlotSupplier() {
683
695
return localActivitySlotSupplier ;
684
696
}
685
697
698
+ @ Nullable
699
+ public String getIdentity () {
700
+ return identity ;
701
+ }
702
+
686
703
@ Override
687
704
public boolean equals (Object o ) {
688
705
if (this == o ) return true ;
@@ -706,7 +723,8 @@ && compare(maxTaskQueueActivitiesPerSecond, that.maxTaskQueueActivitiesPerSecond
706
723
&& Objects .equals (defaultHeartbeatThrottleInterval , that .defaultHeartbeatThrottleInterval )
707
724
&& Objects .equals (stickyQueueScheduleToStartTimeout , that .stickyQueueScheduleToStartTimeout )
708
725
&& Objects .equals (buildId , that .buildId )
709
- && Objects .equals (stickyTaskQueueDrainTimeout , that .stickyTaskQueueDrainTimeout );
726
+ && Objects .equals (stickyTaskQueueDrainTimeout , that .stickyTaskQueueDrainTimeout )
727
+ && Objects .equals (identity , that .identity );
710
728
}
711
729
712
730
@ Override
@@ -730,7 +748,8 @@ public int hashCode() {
730
748
disableEagerExecution ,
731
749
useBuildIdForVersioning ,
732
750
buildId ,
733
- stickyTaskQueueDrainTimeout );
751
+ stickyTaskQueueDrainTimeout ,
752
+ identity );
734
753
}
735
754
736
755
@ Override
@@ -775,6 +794,8 @@ public String toString() {
775
794
+ '\''
776
795
+ ", stickyTaskQueueDrainTimeout="
777
796
+ stickyTaskQueueDrainTimeout
797
+ + ", identity="
798
+ + identity
778
799
+ '}' ;
779
800
}
780
801
}
0 commit comments