This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 6297c72 CAMEL-15231: camel-pulsar Support topic patterns in Pulsar
when subscribing (#3948)
6297c72 is described below
commit 6297c72f0f9205e3b2fbdba623b05821e6f21d59
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jun 25 15:13:19 2020 +0200
CAMEL-15231: camel-pulsar Support topic patterns in Pulsar when subscribing
(#3948)
CAMEL-15231: camel-pulsar Support topic patterns in Pulsar when subscribing
---
.../apache/camel/catalog/components/pulsar.json | 2 +
.../camel/catalog/docs/pulsar-component.adoc | 6 +-
.../pulsar/PulsarComponentConfigurer.java | 10 ++
.../component/pulsar/PulsarEndpointConfigurer.java | 10 ++
.../org/apache/camel/component/pulsar/pulsar.json | 4 +
.../src/main/docs/pulsar-component.adoc | 8 +-
.../component/pulsar/PulsarConfiguration.java | 29 ++++++
.../consumers/CommonCreationStrategyImpl.java | 13 ++-
.../pulsar/PulsarConsumerPatternInTest.java | 112 +++++++++++++++++++++
.../camel/component/pulsar/PulsarTestSupport.java | 4 +
.../dsl/PulsarComponentBuilderFactory.java | 31 ++++++
.../endpoint/dsl/PulsarEndpointBuilderFactory.java | 69 +++++++++++++
.../modules/ROOT/pages/pulsar-component.adoc | 6 +-
13 files changed, 297 insertions(+), 7 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
index 375ce42..b2469ca 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
@@ -36,6 +36,7 @@
"subscriptionInitialPosition": { "kind": "property", "displayName":
"Subscription Initial Position", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition",
"enum": [ "EARLIEST", "LATEST" ], "deprecated": false, "secret": false,
"defaultValue": "LATEST", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", [...]
"subscriptionName": { "kind": "property", "displayName": "Subscription
Name", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "secret": false,
"defaultValue": "subs", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Name of the subscription to use" },
"subscriptionType": { "kind": "property", "displayName": "Subscription
Type", "group": "consumer", "label": "consumer", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionType", "enum": [
"EXCLUSIVE", "SHARED", "FAILOVER", "KEY_SHARED" ], "deprecated": false,
"secret": false, "defaultValue": "EXCLUSIVE", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "de [...]
+ "topicsPattern": { "kind": "property", "displayName": "Topics Pattern",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in th
[...]
"pulsarMessageReceiptFactory": { "kind": "property", "displayName":
"Pulsar Message Receipt Factory", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.PulsarMessageReceiptFactory", "deprecated":
false, "secret": false, "description": "Provide a factory to create an
alternate implementation of PulsarMessageReceipt." },
"batcherBuilder": { "kind": "property", "displayName": "Batcher Builder",
"group": "producer", "label": "producer", "required": false, "type": "object",
"javaType": "org.apache.pulsar.client.api.BatcherBuilder", "deprecated": false,
"secret": false, "defaultValue": "DEFAULT", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Control batching method used by the producer."
},
"batchingEnabled": { "kind": "property", "displayName": "Batching
Enabled", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": "true", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Control whether automatic batching of messages
is enabled for the producer." },
@@ -74,6 +75,7 @@
"subscriptionInitialPosition": { "kind": "parameter", "displayName":
"Subscription Initial Position", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition",
"enum": [ "EARLIEST", "LATEST" ], "deprecated": false, "secret": false,
"defaultValue": "LATEST", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfigur [...]
"subscriptionName": { "kind": "parameter", "displayName": "Subscription
Name", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "secret": false,
"defaultValue": "subs", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Name of the subscription to use" },
"subscriptionType": { "kind": "parameter", "displayName": "Subscription
Type", "group": "consumer", "label": "consumer", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionType", "enum": [
"EXCLUSIVE", "SHARED", "FAILOVER", "KEY_SHARED" ], "deprecated": false,
"secret": false, "defaultValue": "EXCLUSIVE", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguratio [...]
+ "topicsPattern": { "kind": "parameter", "displayName": "Topics Pattern",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topic [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "secret": false, "description": "To let the consumer use a
custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled
then this option is not in use. By default the consumer will deal with [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
"batcherBuilder": { "kind": "parameter", "displayName": "Batcher Builder",
"group": "producer", "label": "producer", "required": false, "type": "object",
"javaType": "org.apache.pulsar.client.api.BatcherBuilder", "deprecated": false,
"secret": false, "defaultValue": "DEFAULT", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Control batching method used by the
producer." },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
index 54b8401..044cdea 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
@@ -35,7 +35,7 @@ pulsar:[persistent|non-persistent]://tenant/namespace/topic
// component options: START
-The Pulsar component supports 33 options, which are listed below.
+The Pulsar component supports 34 options, which are listed below.
@@ -57,6 +57,7 @@ The Pulsar component supports 33 options, which are listed
below.
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *pulsarMessageReceiptFactory* (consumer) | Provide a factory to create an
alternate implementation of PulsarMessageReceipt. | |
PulsarMessageReceiptFactory
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder
| *batchingEnabled* (producer) | Control whether automatic batching of
messages is enabled for the producer. | true | boolean
@@ -104,7 +105,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (32 parameters):
+=== Query Parameters (33 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -124,6 +125,7 @@ with the following path and query parameters:
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *exceptionHandler* (consumer) | To let the consumer use a custom
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this
option is not in use. By default the consumer will deal with exceptions, that
will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. The value can be one of: InOnly, InOut, InOptionalOut | |
ExchangePattern
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder
diff --git
a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
index b2e8daa..d3164a4 100644
---
a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
+++
b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
@@ -89,8 +89,12 @@ public class PulsarComponentConfigurer extends
PropertyConfigurerSupport impleme
case "subscriptionInitialPosition":
getOrCreateConfiguration(target).setSubscriptionInitialPosition(property(camelContext,
org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition.class,
value)); return true;
case "subscriptionname":
case "subscriptionName":
getOrCreateConfiguration(target).setSubscriptionName(property(camelContext,
java.lang.String.class, value)); return true;
+ case "subscriptiontopicsmode":
+ case "subscriptionTopicsMode":
getOrCreateConfiguration(target).setSubscriptionTopicsMode(property(camelContext,
org.apache.pulsar.client.api.RegexSubscriptionMode.class, value)); return true;
case "subscriptiontype":
case "subscriptionType":
getOrCreateConfiguration(target).setSubscriptionType(property(camelContext,
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType.class,
value)); return true;
+ case "topicspattern":
+ case "topicsPattern":
getOrCreateConfiguration(target).setTopicsPattern(property(camelContext,
boolean.class, value)); return true;
default: return false;
}
}
@@ -130,7 +134,9 @@ public class PulsarComponentConfigurer extends
PropertyConfigurerSupport impleme
answer.put("sendTimeoutMs", int.class);
answer.put("subscriptionInitialPosition",
org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition.class);
answer.put("subscriptionName", java.lang.String.class);
+ answer.put("subscriptionTopicsMode",
org.apache.pulsar.client.api.RegexSubscriptionMode.class);
answer.put("subscriptionType",
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType.class);
+ answer.put("topicsPattern", boolean.class);
return answer;
}
@@ -201,8 +207,12 @@ public class PulsarComponentConfigurer extends
PropertyConfigurerSupport impleme
case "subscriptionInitialPosition": return
getOrCreateConfiguration(target).getSubscriptionInitialPosition();
case "subscriptionname":
case "subscriptionName": return
getOrCreateConfiguration(target).getSubscriptionName();
+ case "subscriptiontopicsmode":
+ case "subscriptionTopicsMode": return
getOrCreateConfiguration(target).getSubscriptionTopicsMode();
case "subscriptiontype":
case "subscriptionType": return
getOrCreateConfiguration(target).getSubscriptionType();
+ case "topicspattern":
+ case "topicsPattern": return
getOrCreateConfiguration(target).isTopicsPattern();
default: return null;
}
}
diff --git
a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarEndpointConfigurer.java
b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarEndpointConfigurer.java
index c75ccb8..7ecf404 100644
---
a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarEndpointConfigurer.java
+++
b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarEndpointConfigurer.java
@@ -79,9 +79,13 @@ public class PulsarEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "subscriptionInitialPosition":
target.getPulsarConfiguration().setSubscriptionInitialPosition(property(camelContext,
org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition.class,
value)); return true;
case "subscriptionname":
case "subscriptionName":
target.getPulsarConfiguration().setSubscriptionName(property(camelContext,
java.lang.String.class, value)); return true;
+ case "subscriptiontopicsmode":
+ case "subscriptionTopicsMode":
target.getPulsarConfiguration().setSubscriptionTopicsMode(property(camelContext,
org.apache.pulsar.client.api.RegexSubscriptionMode.class, value)); return true;
case "subscriptiontype":
case "subscriptionType":
target.getPulsarConfiguration().setSubscriptionType(property(camelContext,
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType.class,
value)); return true;
case "synchronous": target.setSynchronous(property(camelContext,
boolean.class, value)); return true;
+ case "topicspattern":
+ case "topicsPattern":
target.getPulsarConfiguration().setTopicsPattern(property(camelContext,
boolean.class, value)); return true;
default: return false;
}
}
@@ -119,8 +123,10 @@ public class PulsarEndpointConfigurer extends
PropertyConfigurerSupport implemen
answer.put("sendTimeoutMs", int.class);
answer.put("subscriptionInitialPosition",
org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition.class);
answer.put("subscriptionName", java.lang.String.class);
+ answer.put("subscriptionTopicsMode",
org.apache.pulsar.client.api.RegexSubscriptionMode.class);
answer.put("subscriptionType",
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType.class);
answer.put("synchronous", boolean.class);
+ answer.put("topicsPattern", boolean.class);
return answer;
}
@@ -188,9 +194,13 @@ public class PulsarEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "subscriptionInitialPosition": return
target.getPulsarConfiguration().getSubscriptionInitialPosition();
case "subscriptionname":
case "subscriptionName": return
target.getPulsarConfiguration().getSubscriptionName();
+ case "subscriptiontopicsmode":
+ case "subscriptionTopicsMode": return
target.getPulsarConfiguration().getSubscriptionTopicsMode();
case "subscriptiontype":
case "subscriptionType": return
target.getPulsarConfiguration().getSubscriptionType();
case "synchronous": return target.isSynchronous();
+ case "topicspattern":
+ case "topicsPattern": return
target.getPulsarConfiguration().isTopicsPattern();
default: return null;
}
}
diff --git
a/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
b/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
index 375ce42..82a5a69 100644
---
a/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
+++
b/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
@@ -35,7 +35,9 @@
"numberOfConsumers": { "kind": "property", "displayName": "Number Of
Consumers", "group": "consumer", "label": "consumer", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "secret": false,
"defaultValue": "1", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Number of consumers - defaults to 1" },
"subscriptionInitialPosition": { "kind": "property", "displayName":
"Subscription Initial Position", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition",
"enum": [ "EARLIEST", "LATEST" ], "deprecated": false, "secret": false,
"defaultValue": "LATEST", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", [...]
"subscriptionName": { "kind": "property", "displayName": "Subscription
Name", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "secret": false,
"defaultValue": "subs", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Name of the subscription to use" },
+ "subscriptionTopicsMode": { "kind": "property", "displayName":
"Subscription Topics Mode", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.pulsar.client.api.RegexSubscriptionMode", "enum": [
"PersistentOnly", "NonPersistentOnly", "AllTopics" ], "deprecated": false,
"secret": false, "defaultValue": "PersistentOnly", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration" [...]
"subscriptionType": { "kind": "property", "displayName": "Subscription
Type", "group": "consumer", "label": "consumer", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionType", "enum": [
"EXCLUSIVE", "SHARED", "FAILOVER", "KEY_SHARED" ], "deprecated": false,
"secret": false, "defaultValue": "EXCLUSIVE", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "de [...]
+ "topicsPattern": { "kind": "property", "displayName": "Topics Pattern",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in th
[...]
"pulsarMessageReceiptFactory": { "kind": "property", "displayName":
"Pulsar Message Receipt Factory", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.PulsarMessageReceiptFactory", "deprecated":
false, "secret": false, "description": "Provide a factory to create an
alternate implementation of PulsarMessageReceipt." },
"batcherBuilder": { "kind": "property", "displayName": "Batcher Builder",
"group": "producer", "label": "producer", "required": false, "type": "object",
"javaType": "org.apache.pulsar.client.api.BatcherBuilder", "deprecated": false,
"secret": false, "defaultValue": "DEFAULT", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Control batching method used by the producer."
},
"batchingEnabled": { "kind": "property", "displayName": "Batching
Enabled", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": "true", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"configuration", "description": "Control whether automatic batching of messages
is enabled for the producer." },
@@ -73,7 +75,9 @@
"numberOfConsumers": { "kind": "parameter", "displayName": "Number Of
Consumers", "group": "consumer", "label": "consumer", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "secret": false,
"defaultValue": "1", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Number of consumers - defaults to 1" },
"subscriptionInitialPosition": { "kind": "parameter", "displayName":
"Subscription Initial Position", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition",
"enum": [ "EARLIEST", "LATEST" ], "deprecated": false, "secret": false,
"defaultValue": "LATEST", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfigur [...]
"subscriptionName": { "kind": "parameter", "displayName": "Subscription
Name", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "secret": false,
"defaultValue": "subs", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Name of the subscription to use" },
+ "subscriptionTopicsMode": { "kind": "parameter", "displayName":
"Subscription Topics Mode", "group": "consumer", "label": "consumer",
"required": false, "type": "object", "javaType":
"org.apache.pulsar.client.api.RegexSubscriptionMode", "enum": [
"PersistentOnly", "NonPersistentOnly", "AllTopics" ], "deprecated": false,
"secret": false, "defaultValue": "PersistentOnly", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfigu [...]
"subscriptionType": { "kind": "parameter", "displayName": "Subscription
Type", "group": "consumer", "label": "consumer", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.pulsar.utils.consumers.SubscriptionType", "enum": [
"EXCLUSIVE", "SHARED", "FAILOVER", "KEY_SHARED" ], "deprecated": false,
"secret": false, "defaultValue": "EXCLUSIVE", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguratio [...]
+ "topicsPattern": { "kind": "parameter", "displayName": "Topics Pattern",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topic [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "secret": false, "description": "To let the consumer use a
custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled
then this option is not in use. By default the consumer will deal with [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
"batcherBuilder": { "kind": "parameter", "displayName": "Batcher Builder",
"group": "producer", "label": "producer", "required": false, "type": "object",
"javaType": "org.apache.pulsar.client.api.BatcherBuilder", "deprecated": false,
"secret": false, "defaultValue": "DEFAULT", "configurationClass":
"org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField":
"pulsarConfiguration", "description": "Control batching method used by the
producer." },
diff --git a/components/camel-pulsar/src/main/docs/pulsar-component.adoc
b/components/camel-pulsar/src/main/docs/pulsar-component.adoc
index 54b8401..32b0ab5 100644
--- a/components/camel-pulsar/src/main/docs/pulsar-component.adoc
+++ b/components/camel-pulsar/src/main/docs/pulsar-component.adoc
@@ -35,7 +35,7 @@ pulsar:[persistent|non-persistent]://tenant/namespace/topic
// component options: START
-The Pulsar component supports 33 options, which are listed below.
+The Pulsar component supports 35 options, which are listed below.
@@ -56,7 +56,9 @@ The Pulsar component supports 33 options, which are listed
below.
| *numberOfConsumers* (consumer) | Number of consumers - defaults to 1 | 1 |
int
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
+| *subscriptionTopicsMode* (consumer) | Determines to which topics this
consumer should be subscribed to - Persistent, Non-Persistent, or both. Only
used with pattern subscriptions. The value can be one of: PersistentOnly,
NonPersistentOnly, AllTopics | PersistentOnly | RegexSubscriptionMode
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *pulsarMessageReceiptFactory* (consumer) | Provide a factory to create an
alternate implementation of PulsarMessageReceipt. | |
PulsarMessageReceiptFactory
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder
| *batchingEnabled* (producer) | Control whether automatic batching of
messages is enabled for the producer. | true | boolean
@@ -104,7 +106,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (32 parameters):
+=== Query Parameters (34 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -123,7 +125,9 @@ with the following path and query parameters:
| *numberOfConsumers* (consumer) | Number of consumers - defaults to 1 | 1 |
int
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
+| *subscriptionTopicsMode* (consumer) | Determines to which topics this
consumer should be subscribed to - Persistent, Non-Persistent, or both. Only
used with pattern subscriptions. The value can be one of: PersistentOnly,
NonPersistentOnly, AllTopics | PersistentOnly | RegexSubscriptionMode
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *exceptionHandler* (consumer) | To let the consumer use a custom
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this
option is not in use. By default the consumer will deal with exceptions, that
will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. The value can be one of: InOnly, InOut, InOptionalOut | |
ExchangePattern
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder
diff --git
a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java
b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java
index 615e9b7..c0628ce 100644
---
a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java
+++
b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java
@@ -27,6 +27,8 @@ import org.apache.pulsar.client.api.BatcherBuilder;
import org.apache.pulsar.client.api.CompressionType;
import org.apache.pulsar.client.api.MessageRouter;
import org.apache.pulsar.client.api.MessageRoutingMode;
+import org.apache.pulsar.client.api.RegexSubscriptionMode;
+
import static
org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition.LATEST;
import static
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType.EXCLUSIVE;
@@ -34,6 +36,10 @@ import static
org.apache.camel.component.pulsar.utils.consumers.SubscriptionType
@UriParams
public class PulsarConfiguration implements Cloneable {
+ @UriParam(label = "consumer")
+ private boolean topicsPattern;
+ @UriParam(label = "consumer", defaultValue = "PersistentOnly")
+ private RegexSubscriptionMode subscriptionTopicsMode;
@UriParam(label = "consumer", defaultValue = "subs")
private String subscriptionName = "subs";
@UriParam(label = "consumer", defaultValue = "EXCLUSIVE")
@@ -100,6 +106,29 @@ public class PulsarConfiguration implements Cloneable {
}
}
+ public boolean isTopicsPattern() {
+ return topicsPattern;
+ }
+
+ /**
+ * Whether the topic is a pattern (regular expression) that allows the
consumer to subscribe to all matching topics in the namespace
+ */
+ public void setTopicsPattern(boolean topicsPattern) {
+ this.topicsPattern = topicsPattern;
+ }
+
+ public RegexSubscriptionMode getSubscriptionTopicsMode() {
+ return subscriptionTopicsMode;
+ }
+
+ /**
+ * Determines to which topics this consumer should be subscribed to -
Persistent, Non-Persistent, or both. Only used
+ * with pattern subscriptions.
+ */
+ public void setSubscriptionTopicsMode(RegexSubscriptionMode
subscriptionTopicsMode) {
+ this.subscriptionTopicsMode = subscriptionTopicsMode;
+ }
+
public String getSubscriptionName() {
return subscriptionName;
}
diff --git
a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/consumers/CommonCreationStrategyImpl.java
b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/consumers/CommonCreationStrategyImpl.java
index 0f19172..3dd6b19 100644
---
a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/consumers/CommonCreationStrategyImpl.java
+++
b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/consumers/CommonCreationStrategyImpl.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.pulsar.utils.consumers;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
import org.apache.camel.component.pulsar.PulsarConfiguration;
import org.apache.camel.component.pulsar.PulsarConsumer;
@@ -25,6 +26,7 @@ import
org.apache.camel.component.pulsar.PulsarMessageListener;
import org.apache.pulsar.client.api.ConsumerBuilder;
import org.apache.pulsar.client.api.DeadLetterPolicy;
import org.apache.pulsar.client.api.DeadLetterPolicy.DeadLetterPolicyBuilder;
+import org.apache.pulsar.client.api.RegexSubscriptionMode;
public final class CommonCreationStrategyImpl {
@@ -34,7 +36,16 @@ public final class CommonCreationStrategyImpl {
public static ConsumerBuilder<byte[]> create(final String name, final
PulsarEndpoint pulsarEndpoint, final PulsarConsumer pulsarConsumer) {
final PulsarConfiguration endpointConfiguration =
pulsarEndpoint.getPulsarConfiguration();
- ConsumerBuilder<byte[]> builder =
pulsarEndpoint.getPulsarClient().newConsumer().topic(pulsarEndpoint.getUri()).subscriptionName(endpointConfiguration.getSubscriptionName())
+ ConsumerBuilder<byte[]> builder =
pulsarEndpoint.getPulsarClient().newConsumer();
+ if (endpointConfiguration.isTopicsPattern()) {
+ builder.topicsPattern(pulsarEndpoint.getUri());
+ if (endpointConfiguration.getSubscriptionTopicsMode() != null) {
+
builder.subscriptionTopicsMode(endpointConfiguration.getSubscriptionTopicsMode());
+ }
+ } else {
+ builder.topic(pulsarEndpoint.getUri());
+ }
+ builder.subscriptionName(endpointConfiguration.getSubscriptionName())
.receiverQueueSize(endpointConfiguration.getConsumerQueueSize()).consumerName(name).ackTimeout(endpointConfiguration.getAckTimeoutMillis(),
TimeUnit.MILLISECONDS)
.subscriptionInitialPosition(endpointConfiguration.getSubscriptionInitialPosition().toPulsarSubscriptionInitialPosition())
.acknowledgmentGroupTime(endpointConfiguration.getAckGroupTimeMillis(),
TimeUnit.MILLISECONDS)
diff --git
a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java
b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java
new file mode 100644
index 0000000..bbb4447
--- /dev/null
+++
b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pulsar;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.pulsar.utils.AutoConfiguration;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.SimpleRegistry;
+import org.apache.pulsar.client.admin.PulsarAdmin;
+import org.apache.pulsar.client.admin.internal.PulsarAdminBuilderImpl;
+import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.client.impl.ClientBuilderImpl;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PulsarConsumerPatternInTest extends PulsarTestSupport {
+
+ private static final Logger LOGGER =
LoggerFactory.getLogger(PulsarConsumerPatternInTest.class);
+
+ private static final String TOPIC_URI =
"persistent://public/default/camel-foo";
+ private static final String TOPIC_TWO_URI =
"persistent://public/default/camel-bar";
+ private static final String TOPIC_PATTERN_URI =
"persistent://public/default/camel-.*";
+ private static final String PRODUCER = "camel-producer-1";
+
+ @EndpointInject("pulsar:" + TOPIC_PATTERN_URI + "?topicsPattern=true"
+ +
"&subscriptionName=camel-subscription&consumerQueueSize=5&consumerName=camel-consumer")
+ private Endpoint from;
+
+ @EndpointInject("mock:result")
+ private MockEndpoint to;
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() throws Exception {
+ SimpleRegistry registry = new SimpleRegistry();
+
+ registerPulsarBeans(registry);
+
+ return registry;
+ }
+
+ private void registerPulsarBeans(SimpleRegistry registry) throws
PulsarClientException {
+ PulsarClient pulsarClient = givenPulsarClient();
+ AutoConfiguration autoConfiguration = new AutoConfiguration(null,
null);
+
+ registry.bind("pulsarClient", pulsarClient);
+ PulsarComponent comp = new PulsarComponent(context);
+ comp.setAutoConfiguration(autoConfiguration);
+ comp.setPulsarClient(pulsarClient);
+ registry.bind("pulsar", comp);
+ }
+
+ private PulsarClient givenPulsarClient() throws PulsarClientException {
+ return new
ClientBuilderImpl().serviceUrl(getPulsarBrokerUrl()).ioThreads(1).listenerThreads(1).build();
+ }
+
+ private PulsarAdmin givenPulsarAdmin() throws PulsarClientException {
+ return new
PulsarAdminBuilderImpl().serviceHttpUrl(getPulsarAdminUrl()).build();
+ }
+
+ @Test
+ public void testAMessageToClusterIsConsumed() throws Exception {
+ // must create topics first when using topic patterns for the consumer
+ givenPulsarAdmin().topics().createNonPartitionedTopic("camel-foo");
+ givenPulsarAdmin().topics().createNonPartitionedTopic("camel-bar");
+
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from(from).to(to).process(e -> LOGGER.info("Processing message
{}", e.getIn().getBody(String.class)));
+ }
+ });
+ context.start();
+
+ to.expectedBodiesReceivedInAnyOrder("Hello World!", "Bye World!");
+
+ Producer<String> producer =
givenPulsarClient().newProducer(Schema.STRING).producerName(PRODUCER).topic(TOPIC_URI).create();
+ producer.send("Hello World!");
+
+ Producer<String> producer2 =
givenPulsarClient().newProducer(Schema.STRING).producerName(PRODUCER).topic(TOPIC_TWO_URI).create();
+ producer2.send("Bye World!");
+
+ MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to);
+ }
+}
diff --git
a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java
b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java
index 95a687e..bd9961f 100644
---
a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java
+++
b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java
@@ -42,4 +42,8 @@ public class PulsarTestSupport extends
ContainerAwareTestSupport {
public String getPulsarBrokerUrl() {
return String.format("pulsar://%s:%s",
getContainer(CONTAINER_NAME).getContainerIpAddress(),
getContainer(CONTAINER_NAME).getMappedPort(BROKER_PORT));
}
+
+ public String getPulsarAdminUrl() {
+ return String.format("http://%s:%s",
getContainer(CONTAINER_NAME).getContainerIpAddress(),
getContainer(CONTAINER_NAME).getMappedPort(BROKER_HTTP_PORT));
+ }
}
diff --git
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PulsarComponentBuilderFactory.java
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PulsarComponentBuilderFactory.java
index 3e84985..1dde4d9 100644
---
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PulsarComponentBuilderFactory.java
+++
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PulsarComponentBuilderFactory.java
@@ -248,6 +248,22 @@ public interface PulsarComponentBuilderFactory {
return this;
}
/**
+ * Determines to which topics this consumer should be subscribed to -
+ * Persistent, Non-Persistent, or both. Only used with pattern
+ * subscriptions.
+ *
+ * The option is a:
+ * <code>org.apache.pulsar.client.api.RegexSubscriptionMode</code>
type.
+ *
+ * Default: PersistentOnly
+ * Group: consumer
+ */
+ default PulsarComponentBuilder subscriptionTopicsMode(
+ org.apache.pulsar.client.api.RegexSubscriptionMode
subscriptionTopicsMode) {
+ doSetProperty("subscriptionTopicsMode", subscriptionTopicsMode);
+ return this;
+ }
+ /**
* Type of the subscription EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults
* to EXCLUSIVE.
*
@@ -263,6 +279,19 @@ public interface PulsarComponentBuilderFactory {
return this;
}
/**
+ * Whether the topic is a pattern (regular expression) that allows the
+ * consumer to subscribe to all matching topics in the namespace.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ */
+ default PulsarComponentBuilder topicsPattern(boolean topicsPattern) {
+ doSetProperty("topicsPattern", topicsPattern);
+ return this;
+ }
+ /**
* Provide a factory to create an alternate implementation of
* PulsarMessageReceipt.
*
@@ -550,7 +579,9 @@ public interface PulsarComponentBuilderFactory {
case "numberOfConsumers":
getOrCreateConfiguration((PulsarComponent)
component).setNumberOfConsumers((int) value); return true;
case "subscriptionInitialPosition":
getOrCreateConfiguration((PulsarComponent)
component).setSubscriptionInitialPosition((org.apache.camel.component.pulsar.utils.consumers.SubscriptionInitialPosition)
value); return true;
case "subscriptionName":
getOrCreateConfiguration((PulsarComponent)
component).setSubscriptionName((java.lang.String) value); return true;
+ case "subscriptionTopicsMode":
getOrCreateConfiguration((PulsarComponent)
component).setSubscriptionTopicsMode((org.apache.pulsar.client.api.RegexSubscriptionMode)
value); return true;
case "subscriptionType":
getOrCreateConfiguration((PulsarComponent)
component).setSubscriptionType((org.apache.camel.component.pulsar.utils.consumers.SubscriptionType)
value); return true;
+ case "topicsPattern": getOrCreateConfiguration((PulsarComponent)
component).setTopicsPattern((boolean) value); return true;
case "pulsarMessageReceiptFactory": ((PulsarComponent)
component).setPulsarMessageReceiptFactory((org.apache.camel.component.pulsar.PulsarMessageReceiptFactory)
value); return true;
case "batcherBuilder": getOrCreateConfiguration((PulsarComponent)
component).setBatcherBuilder((org.apache.pulsar.client.api.BatcherBuilder)
value); return true;
case "batchingEnabled": getOrCreateConfiguration((PulsarComponent)
component).setBatchingEnabled((boolean) value); return true;
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PulsarEndpointBuilderFactory.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PulsarEndpointBuilderFactory.java
index 0916760..83fddde 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PulsarEndpointBuilderFactory.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PulsarEndpointBuilderFactory.java
@@ -362,6 +362,38 @@ public interface PulsarEndpointBuilderFactory {
return this;
}
/**
+ * Determines to which topics this consumer should be subscribed to -
+ * Persistent, Non-Persistent, or both. Only used with pattern
+ * subscriptions.
+ *
+ * The option is a:
+ * <code>org.apache.pulsar.client.api.RegexSubscriptionMode</code>
type.
+ *
+ * Default: PersistentOnly
+ * Group: consumer
+ */
+ default PulsarEndpointConsumerBuilder subscriptionTopicsMode(
+ RegexSubscriptionMode subscriptionTopicsMode) {
+ doSetProperty("subscriptionTopicsMode", subscriptionTopicsMode);
+ return this;
+ }
+ /**
+ * Determines to which topics this consumer should be subscribed to -
+ * Persistent, Non-Persistent, or both. Only used with pattern
+ * subscriptions.
+ *
+ * The option will be converted to a
+ * <code>org.apache.pulsar.client.api.RegexSubscriptionMode</code>
type.
+ *
+ * Default: PersistentOnly
+ * Group: consumer
+ */
+ default PulsarEndpointConsumerBuilder subscriptionTopicsMode(
+ String subscriptionTopicsMode) {
+ doSetProperty("subscriptionTopicsMode", subscriptionTopicsMode);
+ return this;
+ }
+ /**
* Type of the subscription EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults
* to EXCLUSIVE.
*
@@ -391,6 +423,33 @@ public interface PulsarEndpointBuilderFactory {
doSetProperty("subscriptionType", subscriptionType);
return this;
}
+ /**
+ * Whether the topic is a pattern (regular expression) that allows the
+ * consumer to subscribe to all matching topics in the namespace.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ */
+ default PulsarEndpointConsumerBuilder topicsPattern(
+ boolean topicsPattern) {
+ doSetProperty("topicsPattern", topicsPattern);
+ return this;
+ }
+ /**
+ * Whether the topic is a pattern (regular expression) that allows the
+ * consumer to subscribe to all matching topics in the namespace.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ */
+ default PulsarEndpointConsumerBuilder topicsPattern(String
topicsPattern) {
+ doSetProperty("topicsPattern", topicsPattern);
+ return this;
+ }
}
/**
@@ -1068,6 +1127,16 @@ public interface PulsarEndpointBuilderFactory {
/**
* Proxy enum for
+ * <code>org.apache.pulsar.client.api.RegexSubscriptionMode</code> enum.
+ */
+ enum RegexSubscriptionMode {
+ PersistentOnly,
+ NonPersistentOnly,
+ AllTopics;
+ }
+
+ /**
+ * Proxy enum for
*
<code>org.apache.camel.component.pulsar.utils.consumers.SubscriptionType</code>
enum.
*/
enum SubscriptionType {
diff --git a/docs/components/modules/ROOT/pages/pulsar-component.adoc
b/docs/components/modules/ROOT/pages/pulsar-component.adoc
index e17805c..f4ba9a4 100644
--- a/docs/components/modules/ROOT/pages/pulsar-component.adoc
+++ b/docs/components/modules/ROOT/pages/pulsar-component.adoc
@@ -37,7 +37,7 @@ pulsar:[persistent|non-persistent]://tenant/namespace/topic
// component options: START
-The Pulsar component supports 33 options, which are listed below.
+The Pulsar component supports 34 options, which are listed below.
@@ -59,6 +59,7 @@ The Pulsar component supports 33 options, which are listed
below.
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *pulsarMessageReceiptFactory* (consumer) | Provide a factory to create an
alternate implementation of PulsarMessageReceipt. | |
PulsarMessageReceiptFactory
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder
| *batchingEnabled* (producer) | Control whether automatic batching of
messages is enabled for the producer. | true | boolean
@@ -106,7 +107,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (32 parameters):
+=== Query Parameters (33 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -126,6 +127,7 @@ with the following path and query parameters:
| *subscriptionInitialPosition* (consumer) | Control the initial position in
the topic of a newly created subscription. Default is latest message. The value
can be one of: EARLIEST, LATEST | LATEST | SubscriptionInitialPosition
| *subscriptionName* (consumer) | Name of the subscription to use | subs |
String
| *subscriptionType* (consumer) | Type of the subscription
EXCLUSIVESHAREDFAILOVERKEY_SHARED, defaults to EXCLUSIVE. The value can be one
of: EXCLUSIVE, SHARED, FAILOVER, KEY_SHARED | EXCLUSIVE | SubscriptionType
+| *topicsPattern* (consumer) | Whether the topic is a pattern (regular
expression) that allows the consumer to subscribe to all matching topics in the
namespace | false | boolean
| *exceptionHandler* (consumer) | To let the consumer use a custom
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this
option is not in use. By default the consumer will deal with exceptions, that
will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer
creates an exchange. The value can be one of: InOnly, InOut, InOptionalOut | |
ExchangePattern
| *batcherBuilder* (producer) | Control batching method used by the producer.
| DEFAULT | BatcherBuilder