Skip to content

Commit

Permalink
feat: update to Quarkus 3.15 LTS (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras authored Dec 4, 2024
1 parent 1ce03eb commit dab696a
Show file tree
Hide file tree
Showing 21 changed files with 1,863 additions and 635 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ZeebeDevProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void hotReload(ZeebeDevServiceBuildTimeConfig buildTimeConfig, BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
if (buildTimeConfig.devMode.watchJobWorker) {
if (buildTimeConfig.devMode().watchJobWorker()) {
additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(JobWorkerReplacementInterceptor.class));
}
}
Expand All @@ -32,12 +32,12 @@ void watchChanges(ZeebeBuildTimeConfig config, ZeebeResourcesBuildItem resources
ZeebeDevServiceBuildTimeConfig buildTimeConfig,
BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths) {

if (!config.resources.enabled) {
if (!config.resources().enabled()) {
return;
}

// add all bpmn resources
if (buildTimeConfig.devMode.watchBpmnFiles) {
if (buildTimeConfig.devMode().watchBpmnFiles()) {
Collection<String> items = resources.getResources();
if (items != null && !items.isEmpty()) {
items.forEach(x -> watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(x)));
Expand All @@ -46,12 +46,12 @@ void watchChanges(ZeebeBuildTimeConfig config, ZeebeResourcesBuildItem resources

// watch directories for new files
// add root directory and all subdirectories
if (buildTimeConfig.devMode.watchBpmnDir) {
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(config.resources.location));
if (buildTimeConfig.devMode().watchBpmnDir()) {
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(config.resources().location()));

try {
Enumeration<URL> location = Thread.currentThread().getContextClassLoader()
.getResources(config.resources.location);
.getResources(config.resources().location());
if (location.hasMoreElements()) {
Files.walk(Path.of(location.nextElement().toURI()))
.filter(Files::isDirectory)
Expand All @@ -61,7 +61,7 @@ void watchChanges(ZeebeBuildTimeConfig config, ZeebeResourcesBuildItem resources
.forEach(dir -> watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(dir)));
}
} catch (Exception ex) {
throw new RuntimeException("Error find all sub-directories of " + config.resources.location, ex);
throw new RuntimeException("Error find all sub-directories of " + config.resources().location(), ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
package io.quarkiverse.zeebe;

import io.quarkiverse.zeebe.devservices.ZeebeDevServicesConfig;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@ConfigRoot(name = "zeebe", phase = ConfigPhase.BUILD_TIME)
public class ZeebeDevServiceBuildTimeConfig {
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
@ConfigMapping(prefix = "quarkus.zeebe")
public interface ZeebeDevServiceBuildTimeConfig {

/**
* Default Dev services configuration.
*/
@ConfigItem(name = "devservices")
public ZeebeDevServicesConfig devService;
@WithName("devservices")
ZeebeDevServicesConfig devService();

/**
* Dev mode configuration.
*/
@ConfigItem(name = "dev-mode")
public DevMode devMode;
@WithName("dev-mode")
DevMode devMode();

@ConfigGroup
public static class DevMode {
interface DevMode {

/**
* Disable or enabled zeebe dashboard dev-ui.
*/
@ConfigItem(name = "dev-ui.enabled", defaultValue = "true")
public boolean devUIEnabled;
@WithName("dev-ui.enabled")
@WithDefault("true")
boolean devUIEnabled();

/**
* Observe changes in the bpmn files.
*/
@ConfigItem(name = "watch-bpmn-files", defaultValue = "true")
public boolean watchBpmnFiles = true;
@WithName("watch-bpmn-files")
@WithDefault("true")
boolean watchBpmnFiles();

/**
* Observe changes in the bpmn directory and subdirectories.
*/
@ConfigItem(name = "watch-bpmn-dir", defaultValue = "true")
public boolean watchBpmnDir = true;
@WithName("watch-bpmn-dir")
@WithDefault("true")
boolean watchBpmnDir();

/**
* Observe changes in the job worker.
*/
@ConfigItem(name = "watch-job-worker", defaultValue = "true")
public boolean watchJobWorker = true;
@WithName("watch-job-worker")
@WithDefault("true")
boolean watchJobWorker();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static class TracingEnabled implements BooleanSupplier {

@Override
public boolean getAsBoolean() {
return config.tracing.enabled;
return config.tracing().enabled();
}
}

Expand All @@ -99,7 +99,7 @@ static class MetricsEnabled implements BooleanSupplier {

@Override
public boolean getAsBoolean() {
return config.metrics.enabled;
return config.metrics().enabled();
}
}

Expand Down Expand Up @@ -294,7 +294,7 @@ void buildZeebeResources(
.fields(true)
.build());

Collection<String> resources = discoverResources(config.resources);
Collection<String> resources = discoverResources(config.resources());
if (!resources.isEmpty()) {
resource.produce(new NativeImageResourceBuildItem(resources.toArray(new String[0])));
}
Expand All @@ -305,8 +305,8 @@ void buildZeebeResources(

@BuildStep
void addHealthCheck(ZeebeBuildTimeConfig config, BuildProducer<HealthBuildItem> healthChecks) {
healthChecks.produce(new HealthBuildItem(ZeebeHealthCheck.class.getName(), config.health.enabled));
healthChecks.produce(new HealthBuildItem(ZeebeTopologyHealthCheck.class.getName(), config.health.enabled));
healthChecks.produce(new HealthBuildItem(ZeebeHealthCheck.class.getName(), config.health().enabled()));
healthChecks.produce(new HealthBuildItem(ZeebeTopologyHealthCheck.class.getName(), config.health().enabled()));
}

@BuildStep
Expand Down Expand Up @@ -353,10 +353,10 @@ NativeImageConfigBuildItem build() {

private Collection<String> discoverResources(ZeebeBuildTimeConfig.ResourcesConfig resourcesConfig)
throws IOException, URISyntaxException {
if (!resourcesConfig.enabled) {
if (!resourcesConfig.enabled()) {
return Collections.emptySet();
}
String location = resourcesConfig.location;
String location = resourcesConfig.location();
LinkedHashSet<String> result = new LinkedHashSet<>();

location = normalizeLocation(location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ public final class ZeebeResourcesBuildItem extends SimpleBuildItem {

final Collection<String> resources;

public ZeebeResourcesBuildItem() {
this.resources = null;
}

public ZeebeResourcesBuildItem(Collection<String> resources) {
this.resources = resources;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public final class ZeebeWorkersBuildItem extends SimpleBuildItem {

final List<JobWorkerMetadata> workers;

public ZeebeWorkersBuildItem() {
this.workers = null;
}

public ZeebeWorkersBuildItem(List<JobWorkerMetadata> workers) {
this.workers = workers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void pages(ZeebeDevServiceBuildTimeConfig buildTimeConfig,
BuildProducer<MenuPageBuildItem> menuProducer,
BuildProducer<JsonRPCProvidersBuildItem> rpcProvidersBuildItemBuildProducer) {

if (!buildTimeConfig.devMode.devUIEnabled || !buildTimeConfig.devService.enabled) {
if (!buildTimeConfig.devMode().devUIEnabled() || !buildTimeConfig.devService().enabled()) {
log.debug(
"Not starting dev-ui for Zeebe as it has been disabled in the config or dev-service has been not enabled");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ZeebeDevServiceProcessor {

private static final String DEFAULT_ZEEBE_VERSION = ZeebeClient.class.getPackage().getImplementationVersion();

private static DockerImageName ZEEBE_IMAGE_NAME = DockerImageName.parse(DEFAULT_ZEEBE_CONTAINER_IMAGE)
private static final DockerImageName ZEEBE_IMAGE_NAME = DockerImageName.parse(DEFAULT_ZEEBE_CONTAINER_IMAGE)
.withTag(DEFAULT_ZEEBE_VERSION);

private static final Logger log = Logger.getLogger(ZeebeDevServiceProcessor.class);
Expand Down Expand Up @@ -144,7 +144,7 @@ private ZeebeRunningDevService startZeebe(DockerStatusBuildItem dockerStatusBuil
return null;
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn(
"Docker isn't working, please configure the zeebe broker servers gateway property ("
+ PROP_ZEEBE_GATEWAY_ADDRESS + ").");
Expand Down Expand Up @@ -247,7 +247,7 @@ private void stopZeebe() {
}

private ZeebeDevServiceCfg getConfiguration(ZeebeDevServiceBuildTimeConfig cfg) {
ZeebeDevServicesConfig devServicesConfig = cfg.devService;
ZeebeDevServicesConfig devServicesConfig = cfg.devService();
return new ZeebeDevServiceCfg(devServicesConfig);
}

Expand All @@ -269,17 +269,17 @@ private static final class ZeebeDevServiceCfg {
private final boolean reuse;

public ZeebeDevServiceCfg(ZeebeDevServicesConfig config) {
this.devServicesEnabled = config.enabled;
this.imageName = config.imageName.orElse(null);
this.fixedExposedPort = config.port.orElse(0);
this.fixedExposedRestPort = config.restPort.orElse(0);
this.shared = config.shared;
this.serviceName = config.serviceName;
this.testExporter = config.test.exporter;
this.testDebugExportPort = config.test.receiverPort.orElse(0);
this.devDebugExporter = config.devExporter.enabled;
this.devServicesEnabled = config.enabled();
this.imageName = config.imageName().orElse(null);
this.fixedExposedPort = config.port().orElse(0);
this.fixedExposedRestPort = config.restPort().orElse(0);
this.shared = config.shared();
this.serviceName = config.serviceName();
this.testExporter = config.test().exporter();
this.testDebugExportPort = config.test().receiverPort().orElse(0);
this.devDebugExporter = config.devExporter().enabled();
this.debugReceiverPort = getPort();
this.reuse = config.reuse;
this.reuse = config.reuse();
}

@Override
Expand Down
Loading

0 comments on commit dab696a

Please sign in to comment.