From e585ba5a19ed303c0c8f8bba5df94d08456494d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=84=8F=E5=85=AE=E5=85=AE?= Date: Thu, 1 Sep 2022 07:05:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20worker=20tag=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autoconfigure/PowerJobAutoConfiguration.java | 4 ++++ .../worker/autoconfigure/PowerJobProperties.java | 15 ++++++++++++++- .../META-INF/spring-configuration-metadata.json | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java b/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java index 3f8b196d..c8673b9b 100644 --- a/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java +++ b/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java @@ -73,6 +73,10 @@ public class PowerJobAutoConfiguration { * Max length of appended workflow context . Appended workflow context value that is longer than the value will be ignore. */ config.setMaxAppendedWfContextLength(worker.getMaxAppendedWfContextLength()); + /* + * Worker Tag + */ + config.setTag(worker.getTag()); /* * Create OhMyWorker object and set properties. */ diff --git a/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobProperties.java b/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobProperties.java index 4cf3ffc2..b9b19461 100644 --- a/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobProperties.java +++ b/powerjob-worker-spring-boot-starter/src/main/java/tech/powerjob/worker/autoconfigure/PowerJobProperties.java @@ -90,6 +90,16 @@ public class PowerJobProperties { getWorker().setEnableTestMode(enableTestMode); } + @Deprecated + @DeprecatedConfigurationProperty(replacement = "powerjob.worker.tag") + public String getTag() { + return getWorker().tag; + } + + @Deprecated + public void setTag(String tag) { + getWorker().setTag(tag); + } /** * Powerjob worker configuration properties. @@ -139,6 +149,9 @@ public class PowerJobProperties { * {@link WorkflowContext} max length for #appendedContextData */ private int maxAppendedWfContextLength = 8192; - + /** + * Worker Tag + */ + private String tag; } } diff --git a/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json b/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json index b79864d3..e2daf190 100644 --- a/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json +++ b/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json @@ -56,6 +56,12 @@ "type": "java.lang.Integer", "description": "Max length of appended workflow context. Appended workflow context that is longer than the value will be ignore.", "sourceType": "tech.powerjob.worker.autoconfigure.PowerJobProperties$Worker" + }, + { + "name": "powerjob.worker.tag", + "type": "java.lang.String", + "description": "Worker Tag", + "sourceType": "tech.powerjob.worker.autoconfigure.PowerJobProperties$Worker" } ], "hints": []