public void startDataIndexDevService()

in quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment/src/main/java/org/kie/kogito/quarkus/workflow/deployment/AbstractDevServicesProcessor.java [81:154]


    public void startDataIndexDevService(
            BuildProducer<AdditionalBeanBuildItem> additionalBean,
            BuildProducer<SystemPropertyBuildItem> systemProperties,
            BuildProducer<KogitoDataIndexServiceAvailableBuildItem> dataIndexServiceAvailableBuildItemBuildProducer,
            LaunchModeBuildItem launchMode,
            KogitoWorkflowBuildTimeConfig buildTimeConfig,
            List<DevServicesSharedNetworkBuildItem> devServicesSharedNetwork,
            Optional<ConsoleInstalledBuildItem> consoleInstalled,
            CuratedApplicationShutdownBuildItem applicationShutdown,
            LoggingSetupBuildItem loggingSetup,
            Capabilities capabilities) {

        DataIndexDevServiceConfig configuration = getConfiguration(buildTimeConfig);

        if (capabilities.isMissing(DATA_INDEX_CAPABILITY) && configuration.devServicesEnabled && isDockerWorking.getAsBoolean()) {
            additionalBean.produce(AdditionalBeanBuildItem.builder().addBeanClass(DataIndexEventPublisher.class).build());
            Integer port = ConfigProvider.getConfig().getOptionalValue("quarkus.http.port", Integer.class).orElse(8080);
            Testcontainers.exposeHostPorts(port);
            systemProperties.produce(new SystemPropertyBuildItem("kogito.service.url", "http://localhost:" + port));
        }

        if (closeable != null) {
            boolean shouldShutdown = !configuration.equals(cfg);
            if (!shouldShutdown) {
                // Signal the service is available when DevServices may have restarted but the service not
                dataIndexServiceAvailableBuildItemBuildProducer.produce(new KogitoDataIndexServiceAvailableBuildItem());
                return;
            }
            shutdownDataIndex();
            cfg = null;
        }

        StartupLogCompressor compressor = new StartupLogCompressor(
                (launchMode.isTest() ? "(test) " : "") + "Kogito Data Index Dev Service starting:",
                consoleInstalled, loggingSetup);

        DataIndexInstance dataIndex;
        try {
            dataIndex = startDataIndex(capabilities, configuration, launchMode, !devServicesSharedNetwork.isEmpty());
            if (dataIndex != null) {
                // Signal the service is available
                dataIndexServiceAvailableBuildItemBuildProducer.produce(new KogitoDataIndexServiceAvailableBuildItem());
                closeable = dataIndex.getCloseable();
                systemProperties.produce(new SystemPropertyBuildItem(KOGITO_DATA_INDEX, dataIndex.getUrl()));
            }
            compressor.close();
        } catch (Exception t) {
            compressor.closeAndDumpCaptured();
            throw new RuntimeException("Failed to start Kogito Data Index Dev Services", t);
        }

        // Configure the watch dog
        if (first) {
            first = false;
            Runnable closeTask = () -> {
                if (closeable != null) {
                    shutdownDataIndex();
                }
                first = true;
                closeable = null;
                cfg = null;
            };
            applicationShutdown.addCloseTask(closeTask, true);
        }
        cfg = configuration;

        if (dataIndex != null && dataIndex.isOwner()) {
            LOGGER.info("Dev Services for Kogito Data Index using image {}", configuration.imageName);
            LOGGER.info(
                    "Dev Services for Kogito Data Index started at {}",
                    dataIndex.getUrl());
        }

    }