Skip to content

Commit

Permalink
CAMEL-19665: camel-git should be batch poll consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 27, 2024
1 parent a782cf4 commit 51f2706
Show file tree
Hide file tree
Showing 11 changed files with 832 additions and 74 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,58 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
switch (ignoreCase ? name.toLowerCase() : name) {
case "allowempty":
case "allowEmpty": target.setAllowEmpty(property(camelContext, boolean.class, value)); return true;
case "backofferrorthreshold":
case "backoffErrorThreshold": target.setBackoffErrorThreshold(property(camelContext, int.class, value)); return true;
case "backoffidlethreshold":
case "backoffIdleThreshold": target.setBackoffIdleThreshold(property(camelContext, int.class, value)); return true;
case "backoffmultiplier":
case "backoffMultiplier": target.setBackoffMultiplier(property(camelContext, int.class, value)); return true;
case "branchname":
case "branchName": target.setBranchName(property(camelContext, java.lang.String.class, value)); return true;
case "bridgeerrorhandler":
case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
case "delay": target.setDelay(property(camelContext, long.class, value)); return true;
case "exceptionhandler":
case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
case "exchangepattern":
case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
case "gitconfigfile":
case "gitConfigFile": target.setGitConfigFile(property(camelContext, java.lang.String.class, value)); return true;
case "greedy": target.setGreedy(property(camelContext, boolean.class, value)); return true;
case "initialdelay":
case "initialDelay": target.setInitialDelay(property(camelContext, long.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "operation": target.setOperation(property(camelContext, java.lang.String.class, value)); return true;
case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true;
case "pollstrategy":
case "pollStrategy": target.setPollStrategy(property(camelContext, org.apache.camel.spi.PollingConsumerPollStrategy.class, value)); return true;
case "remotename":
case "remoteName": target.setRemoteName(property(camelContext, java.lang.String.class, value)); return true;
case "remotepath":
case "remotePath": target.setRemotePath(property(camelContext, java.lang.String.class, value)); return true;
case "repeatcount":
case "repeatCount": target.setRepeatCount(property(camelContext, long.class, value)); return true;
case "runlogginglevel":
case "runLoggingLevel": target.setRunLoggingLevel(property(camelContext, org.apache.camel.LoggingLevel.class, value)); return true;
case "scheduledexecutorservice":
case "scheduledExecutorService": target.setScheduledExecutorService(property(camelContext, java.util.concurrent.ScheduledExecutorService.class, value)); return true;
case "scheduler": target.setScheduler(property(camelContext, java.lang.Object.class, value)); return true;
case "schedulerproperties":
case "schedulerProperties": target.setSchedulerProperties(property(camelContext, java.util.Map.class, value)); return true;
case "sendemptymessagewhenidle":
case "sendEmptyMessageWhenIdle": target.setSendEmptyMessageWhenIdle(property(camelContext, boolean.class, value)); return true;
case "startscheduler":
case "startScheduler": target.setStartScheduler(property(camelContext, boolean.class, value)); return true;
case "tagname":
case "tagName": target.setTagName(property(camelContext, java.lang.String.class, value)); return true;
case "targetbranchname":
case "targetBranchName": target.setTargetBranchName(property(camelContext, java.lang.String.class, value)); return true;
case "timeunit":
case "timeUnit": target.setTimeUnit(property(camelContext, java.util.concurrent.TimeUnit.class, value)); return true;
case "type": target.setType(property(camelContext, org.apache.camel.component.git.consumer.GitType.class, value)); return true;
case "usefixeddelay":
case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true;
case "username": target.setUsername(property(camelContext, java.lang.String.class, value)); return true;
default: return false;
}
Expand All @@ -58,29 +87,58 @@ public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "allowempty":
case "allowEmpty": return boolean.class;
case "backofferrorthreshold":
case "backoffErrorThreshold": return int.class;
case "backoffidlethreshold":
case "backoffIdleThreshold": return int.class;
case "backoffmultiplier":
case "backoffMultiplier": return int.class;
case "branchname":
case "branchName": return java.lang.String.class;
case "bridgeerrorhandler":
case "bridgeErrorHandler": return boolean.class;
case "delay": return long.class;
case "exceptionhandler":
case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class;
case "exchangepattern":
case "exchangePattern": return org.apache.camel.ExchangePattern.class;
case "gitconfigfile":
case "gitConfigFile": return java.lang.String.class;
case "greedy": return boolean.class;
case "initialdelay":
case "initialDelay": return long.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
case "operation": return java.lang.String.class;
case "password": return java.lang.String.class;
case "pollstrategy":
case "pollStrategy": return org.apache.camel.spi.PollingConsumerPollStrategy.class;
case "remotename":
case "remoteName": return java.lang.String.class;
case "remotepath":
case "remotePath": return java.lang.String.class;
case "repeatcount":
case "repeatCount": return long.class;
case "runlogginglevel":
case "runLoggingLevel": return org.apache.camel.LoggingLevel.class;
case "scheduledexecutorservice":
case "scheduledExecutorService": return java.util.concurrent.ScheduledExecutorService.class;
case "scheduler": return java.lang.Object.class;
case "schedulerproperties":
case "schedulerProperties": return java.util.Map.class;
case "sendemptymessagewhenidle":
case "sendEmptyMessageWhenIdle": return boolean.class;
case "startscheduler":
case "startScheduler": return boolean.class;
case "tagname":
case "tagName": return java.lang.String.class;
case "targetbranchname":
case "targetBranchName": return java.lang.String.class;
case "timeunit":
case "timeUnit": return java.util.concurrent.TimeUnit.class;
case "type": return org.apache.camel.component.git.consumer.GitType.class;
case "usefixeddelay":
case "useFixedDelay": return boolean.class;
case "username": return java.lang.String.class;
default: return null;
}
Expand All @@ -92,32 +150,70 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "allowempty":
case "allowEmpty": return target.isAllowEmpty();
case "backofferrorthreshold":
case "backoffErrorThreshold": return target.getBackoffErrorThreshold();
case "backoffidlethreshold":
case "backoffIdleThreshold": return target.getBackoffIdleThreshold();
case "backoffmultiplier":
case "backoffMultiplier": return target.getBackoffMultiplier();
case "branchname":
case "branchName": return target.getBranchName();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "delay": return target.getDelay();
case "exceptionhandler":
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
case "gitconfigfile":
case "gitConfigFile": return target.getGitConfigFile();
case "greedy": return target.isGreedy();
case "initialdelay":
case "initialDelay": return target.getInitialDelay();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "operation": return target.getOperation();
case "password": return target.getPassword();
case "pollstrategy":
case "pollStrategy": return target.getPollStrategy();
case "remotename":
case "remoteName": return target.getRemoteName();
case "remotepath":
case "remotePath": return target.getRemotePath();
case "repeatcount":
case "repeatCount": return target.getRepeatCount();
case "runlogginglevel":
case "runLoggingLevel": return target.getRunLoggingLevel();
case "scheduledexecutorservice":
case "scheduledExecutorService": return target.getScheduledExecutorService();
case "scheduler": return target.getScheduler();
case "schedulerproperties":
case "schedulerProperties": return target.getSchedulerProperties();
case "sendemptymessagewhenidle":
case "sendEmptyMessageWhenIdle": return target.isSendEmptyMessageWhenIdle();
case "startscheduler":
case "startScheduler": return target.isStartScheduler();
case "tagname":
case "tagName": return target.getTagName();
case "targetbranchname":
case "targetBranchName": return target.getTargetBranchName();
case "timeunit":
case "timeUnit": return target.getTimeUnit();
case "type": return target.getType();
case "usefixeddelay":
case "useFixedDelay": return target.isUseFixedDelay();
case "username": return target.getUsername();
default: return null;
}
}

@Override
public Object getCollectionValueType(Object target, String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "schedulerproperties":
case "schedulerProperties": return java.lang.Object.class;
default: return null;
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,47 @@ public class GitEndpointUriFactory extends org.apache.camel.support.component.En
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
Set<String> props = new HashSet<>(16);
Set<String> props = new HashSet<>(32);
props.add("allowEmpty");
props.add("backoffErrorThreshold");
props.add("backoffIdleThreshold");
props.add("backoffMultiplier");
props.add("branchName");
props.add("bridgeErrorHandler");
props.add("delay");
props.add("exceptionHandler");
props.add("exchangePattern");
props.add("gitConfigFile");
props.add("greedy");
props.add("initialDelay");
props.add("lazyStartProducer");
props.add("localPath");
props.add("operation");
props.add("password");
props.add("pollStrategy");
props.add("remoteName");
props.add("remotePath");
props.add("repeatCount");
props.add("runLoggingLevel");
props.add("scheduledExecutorService");
props.add("scheduler");
props.add("schedulerProperties");
props.add("sendEmptyMessageWhenIdle");
props.add("startScheduler");
props.add("tagName");
props.add("targetBranchName");
props.add("timeUnit");
props.add("type");
props.add("useFixedDelay");
props.add("username");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
SECRET_PROPERTY_NAMES = Collections.emptySet();
MULTI_VALUE_PREFIXES = Collections.emptySet();
Set<String> secretProps = new HashSet<>(2);
secretProps.add("password");
secretProps.add("username");
SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
Set<String> prefixes = new HashSet<>(1);
prefixes.add("scheduler.");
MULTI_VALUE_PREFIXES = Collections.unmodifiableSet(prefixes);
}

@Override
Expand Down
Loading

0 comments on commit 51f2706

Please # to comment.