4343@ Configuration
4444public class RqueueConfig {
4545
46+ @ Getter
4647 private static final String brokerId = UUID .randomUUID ().toString ();
48+
4749 private static final AtomicLong counter = new AtomicLong (1 );
4850 private final RedisConnectionFactory connectionFactory ;
4951 private final ReactiveRedisConnectionFactory reactiveRedisConnectionFactory ;
@@ -139,9 +141,26 @@ public class RqueueConfig {
139141 @ Value ("${rqueue.completed.job.cleanup.interval:30000}" )
140142 private long completedJobCleanupIntervalInMs ;
141143
142- public static String getBrokerId () {
143- return brokerId ;
144- }
144+ @ Value ("${rqueue.worker.registry.enabled:true}" )
145+ private boolean workerRegistryEnabled ;
146+
147+ @ Value ("${rqueue.worker.registry.worker.ttl:300}" )
148+ private long workerRegistryWorkerTtlInSeconds ;
149+
150+ @ Value ("${rqueue.worker.registry.worker.heartbeat.interval:60}" )
151+ private long workerRegistryWorkerHeartbeatIntervalInSeconds ;
152+
153+ @ Value ("${rqueue.worker.registry.queue.ttl:3600}" )
154+ private long workerRegistryQueueTtlInSeconds ;
155+
156+ @ Value ("${rqueue.worker.registry.queue.heartbeat.interval:15}" )
157+ private long workerRegistryQueueHeartbeatIntervalInSeconds ;
158+
159+ @ Value ("${rqueue.worker.registry.key.prefix:worker::}" )
160+ private String workerRegistryKeyPrefix ;
161+
162+ @ Value ("${rqueue.worker.registry.queue.key.prefix:q-pollers::}" )
163+ private String workerRegistryQueueKeyPrefix ;
145164
146165 public boolean messageInTerminalStateShouldBeStored () {
147166 return getMessageDurabilityInTerminalStateInSecond () > 0 ;
@@ -294,6 +313,14 @@ public String getJobsKey(String messageId) {
294313 return prefix + jobsCollectionNamePrefix + messageId ;
295314 }
296315
316+ public String getWorkerRegistryKey (String workerId ) {
317+ return prefix + workerRegistryKeyPrefix + workerId ;
318+ }
319+
320+ public String getWorkerRegistryQueueKey (String queueName ) {
321+ return prefix + workerRegistryQueueKeyPrefix + getTaggedName (queueName );
322+ }
323+
297324 public String getDelDataName (String queueName ) {
298325 return prefix
299326 + delPrefix
@@ -307,6 +334,22 @@ public Duration getJobDurabilityInTerminalState() {
307334 return Duration .ofSeconds (jobDurabilityInTerminalStateInSecond );
308335 }
309336
337+ public Duration getWorkerRegistryWorkerTtl () {
338+ return Duration .ofSeconds (workerRegistryWorkerTtlInSeconds );
339+ }
340+
341+ public Duration getWorkerRegistryWorkerHeartbeatInterval () {
342+ return Duration .ofSeconds (workerRegistryWorkerHeartbeatIntervalInSeconds );
343+ }
344+
345+ public Duration getWorkerRegistryQueueTtl () {
346+ return Duration .ofSeconds (workerRegistryQueueTtlInSeconds );
347+ }
348+
349+ public Duration getWorkerRegistryQueueHeartbeatInterval () {
350+ return Duration .ofSeconds (workerRegistryQueueHeartbeatIntervalInSeconds );
351+ }
352+
310353 public String getLibVersion () {
311354 if (StringUtils .isEmpty (version )) {
312355 ClassPathResource resource =
0 commit comments