Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
fix: some inbound beans are created unnecessarily (#393)
Browse files Browse the repository at this point in the history
* fix: some inbound beans are created unnecessarily

* fix: add InboundPollingConfiguration bean as a marker bean for polling config
  • Loading branch information
markfarkas-camunda authored Apr 3, 2023
1 parent f554421 commit a712178
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.camunda.connector.runtime.inbound.configs;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/*
* This is a marker bean to indicate of polling is enabled.
* */
@Component
@ConditionalOnProperty("camunda.connector.polling.enabled")
public class InboundPollingConfiguration {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.camunda.connector.impl.inbound.InboundConnectorProperties;
import io.camunda.connector.impl.inbound.correlation.MessageCorrelationPoint;
import io.camunda.connector.impl.inbound.correlation.StartEventCorrelationPoint;
import io.camunda.connector.runtime.inbound.configs.InboundPollingConfiguration;
import io.camunda.operate.CamundaOperateClient;
import io.camunda.operate.dto.ProcessDefinition;
import io.camunda.operate.exception.OperateException;
Expand All @@ -25,12 +26,14 @@
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Component;

/**
* Inspects the imported process definitions and extracts Inbound Connector definitions as {@link ProcessCorrelationPoint}.
*/
@Component
@ConditionalOnBean(InboundPollingConfiguration.class)
public class ProcessDefinitionInspector {

private static final Logger LOG = LoggerFactory.getLogger(ProcessDefinitionInspector.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.camunda.connector.api.inbound.InboundConnectorExecutable;
import io.camunda.connector.api.secret.SecretProvider;
import io.camunda.connector.impl.inbound.InboundConnectorProperties;
import io.camunda.connector.runtime.inbound.configs.InboundPollingConfiguration;
import io.camunda.connector.runtime.inbound.importer.ProcessDefinitionInspector;
import io.camunda.connector.runtime.util.inbound.InboundConnectorContextImpl;
import io.camunda.connector.runtime.util.inbound.InboundConnectorFactory;
Expand All @@ -20,9 +21,11 @@
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Component;

@Component
@ConditionalOnBean(InboundPollingConfiguration.class)
public class InboundConnectorManager {
private static final Logger LOG = LoggerFactory.getLogger(InboundConnectorManager.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.camunda.connector.runtime.inbound.lifecycle;

import io.camunda.connector.impl.inbound.InboundConnectorProperties;
import io.camunda.connector.runtime.inbound.configs.InboundPollingConfiguration;
import io.camunda.connector.runtime.inbound.webhook.WebhookConnectorProperties;
import io.camunda.connector.runtime.inbound.webhook.WebhookConnectorRegistry;
import java.util.ArrayList;
Expand All @@ -10,11 +11,14 @@
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@ConditionalOnBean(InboundPollingConfiguration.class)
public class InboundConnectorRestController {

private final InboundConnectorManager inboundManager;
Expand Down

0 comments on commit a712178

Please sign in to comment.