Also, If you use a queue and not a topic, the subscriptionName is not
mandatory.

I think we should revert this.

Il giorno lun 28 mar 2022 alle ore 08:59 Claus Ibsen <claus.ib...@gmail.com>
ha scritto:

> Hi Babak
>
> Did you consider that the producer may not require this parameter? And
> if so then it cannot be marked as required.
> You can only add this in its documentation, and have some code that
> checks when creating the consumer that the option is present.
>
> It's a limitation with @UriParam that we cannot mark things as
> required only for consumer vs producer.
>
> On Mon, Mar 28, 2022 at 1:07 AM <bvah...@apache.org> wrote:
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > bvahdat pushed a commit to branch azure-servicebus-subscriptionName
> > in repository https://gitbox.apache.org/repos/asf/camel.git
> >
> > commit 334f1c3e8d3aeef287548f168379e7c62da975b6
> > Author: Babak Vahdat <bvah...@apache.org>
> > AuthorDate: Mon Mar 28 01:04:57 2022 +0200
> >
> >     azure-servicebus subscriptionName is required by it's consumer
> > ---
> >  .../org/apache/camel/catalog/components/azure-servicebus.json         |
> 4 ++--
> >  .../org/apache/camel/component/azure/servicebus/azure-servicebus.json |
> 4 ++--
> >  .../camel/component/azure/servicebus/ServiceBusConfiguration.java     |
> 1 +
> >  .../camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java  |
> 1 +
> >  4 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git
> a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
> b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
> > index bb91029..a20b0e5 100644
> > ---
> a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
> > +++
> b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
> > @@ -37,7 +37,7 @@
> >      "receiverAsyncClient": { "kind": "property", "displayName":
> "Receiver Async Client", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient",
> "deprecated": false, "deprecationNote": "", "autowired": true, "secret":
> false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the receiverAsy
> [...]
> >      "serviceBusReceiveMode": { "kind": "property", "displayName":
> "Service Bus Receive Mode", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [
> "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired":
> false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationFie [...]
> >      "subQueue": { "kind": "property", "displayName": "Sub Queue",
> "group": "consumer", "label": "consumer", "required": false, "type":
> "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue",
> "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ],
> "deprecated": false, "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the [...]
> > -    "subscriptionName": { "kind": "property", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> false, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "autowired": false, "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQueueName and serviceBusT
> [...]
> > +    "subscriptionName": { "kind": "property", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> true, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "deprecationNote": "", "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQue [...]
> >      "lazyStartProducer": { "kind": "property", "displayName": "Lazy
> Start Producer", "group": "producer", "label": "producer", "required":
> false, "type": "boolean", "javaType": "boolean", "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": false, "description":
> "Whether the producer should be started lazy (on the first message). By
> starting lazy you can use this to allow CamelContext and routes to startup
> in situations where a producer may otherwise fail during star [...]
> >      "producerOperation": { "kind": "property", "displayName": "Producer
> Operation", "group": "producer", "label": "producer", "required": false,
> "type": "object", "javaType":
> "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition",
> "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": "sendMessages",
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "
> [...]
> >      "scheduledEnqueueTime": { "kind": "property", "displayName":
> "Scheduled Enqueue Time", "group": "producer", "label": "producer",
> "required": false, "type": "object", "javaType":
> "java.time.OffsetDateTime", "deprecated": false, "autowired": false,
> "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets OffsetDateTime
> at which the message should appear in the Service Bus qu [...]
> > @@ -91,7 +91,7 @@
> >      "receiverAsyncClient": { "kind": "parameter", "displayName":
> "Receiver Async Client", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient",
> "deprecated": false, "deprecationNote": "", "autowired": true, "secret":
> false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the receiverAs
> [...]
> >      "serviceBusReceiveMode": { "kind": "parameter", "displayName":
> "Service Bus Receive Mode", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [
> "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired":
> false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationFi [...]
> >      "subQueue": { "kind": "parameter", "displayName": "Sub Queue",
> "group": "consumer", "label": "consumer", "required": false, "type":
> "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue",
> "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ],
> "deprecated": false, "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets th [...]
> > -    "subscriptionName": { "kind": "parameter", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> false, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "autowired": false, "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQueueName and serviceBus
> [...]
> > +    "subscriptionName": { "kind": "parameter", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> true, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "deprecationNote": "", "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQu [...]
> >      "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, "autowired": 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 con [...]
> >      "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, "autowired": false, "secret":
> false, "description": "Sets the exchange pattern when the consumer creates
> an exchange." },
> >      "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy
> Start Producer", "group": "producer", "label": "producer", "required":
> false, "type": "boolean", "javaType": "boolean", "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": false, "description":
> "Whether the producer should be started lazy (on the first message). By
> starting lazy you can use this to allow CamelContext and routes to startup
> in situations where a producer may otherwise fail during sta [...]
> > diff --git
> a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
> b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
> > index bb91029..a20b0e5 100644
> > ---
> a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
> > +++
> b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
> > @@ -37,7 +37,7 @@
> >      "receiverAsyncClient": { "kind": "property", "displayName":
> "Receiver Async Client", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient",
> "deprecated": false, "deprecationNote": "", "autowired": true, "secret":
> false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the receiverAsy
> [...]
> >      "serviceBusReceiveMode": { "kind": "property", "displayName":
> "Service Bus Receive Mode", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [
> "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired":
> false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationFie [...]
> >      "subQueue": { "kind": "property", "displayName": "Sub Queue",
> "group": "consumer", "label": "consumer", "required": false, "type":
> "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue",
> "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ],
> "deprecated": false, "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the [...]
> > -    "subscriptionName": { "kind": "property", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> false, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "autowired": false, "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQueueName and serviceBusT
> [...]
> > +    "subscriptionName": { "kind": "property", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> true, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "deprecationNote": "", "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQue [...]
> >      "lazyStartProducer": { "kind": "property", "displayName": "Lazy
> Start Producer", "group": "producer", "label": "producer", "required":
> false, "type": "boolean", "javaType": "boolean", "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": false, "description":
> "Whether the producer should be started lazy (on the first message). By
> starting lazy you can use this to allow CamelContext and routes to startup
> in situations where a producer may otherwise fail during star [...]
> >      "producerOperation": { "kind": "property", "displayName": "Producer
> Operation", "group": "producer", "label": "producer", "required": false,
> "type": "object", "javaType":
> "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition",
> "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": "sendMessages",
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "
> [...]
> >      "scheduledEnqueueTime": { "kind": "property", "displayName":
> "Scheduled Enqueue Time", "group": "producer", "label": "producer",
> "required": false, "type": "object", "javaType":
> "java.time.OffsetDateTime", "deprecated": false, "autowired": false,
> "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets OffsetDateTime
> at which the message should appear in the Service Bus qu [...]
> > @@ -91,7 +91,7 @@
> >      "receiverAsyncClient": { "kind": "parameter", "displayName":
> "Receiver Async Client", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient",
> "deprecated": false, "deprecationNote": "", "autowired": true, "secret":
> false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the receiverAs
> [...]
> >      "serviceBusReceiveMode": { "kind": "parameter", "displayName":
> "Service Bus Receive Mode", "group": "consumer", "label": "consumer",
> "required": false, "type": "object", "javaType":
> "com.azure.messaging.servicebus.models.ServiceBusReceiveMode", "enum": [
> "PEEK_LOCK", "RECEIVE_AND_DELETE" ], "deprecated": false, "autowired":
> false, "secret": false, "defaultValue": "PEEK_LOCK", "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationFi [...]
> >      "subQueue": { "kind": "parameter", "displayName": "Sub Queue",
> "group": "consumer", "label": "consumer", "required": false, "type":
> "object", "javaType": "com.azure.messaging.servicebus.models.SubQueue",
> "enum": [ "NONE", "DEAD_LETTER_QUEUE", "TRANSFER_DEAD_LETTER_QUEUE" ],
> "deprecated": false, "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets th [...]
> > -    "subscriptionName": { "kind": "parameter", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> false, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "autowired": false, "secret": false, "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQueueName and serviceBus
> [...]
> > +    "subscriptionName": { "kind": "parameter", "displayName":
> "Subscription Name", "group": "consumer", "label": "consumer", "required":
> true, "type": "string", "javaType": "java.lang.String", "deprecated":
> false, "deprecationNote": "", "autowired": false, "secret": false,
> "configurationClass":
> "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration",
> "configurationField": "configuration", "description": "Sets the name of the
> subscription in the topic to listen to. topicOrQu [...]
> >      "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, "autowired": 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 con [...]
> >      "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, "autowired": false, "secret":
> false, "description": "Sets the exchange pattern when the consumer creates
> an exchange." },
> >      "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy
> Start Producer", "group": "producer", "label": "producer", "required":
> false, "type": "boolean", "javaType": "boolean", "deprecated": false,
> "autowired": false, "secret": false, "defaultValue": false, "description":
> "Whether the producer should be started lazy (on the first message). By
> starting lazy you can use this to allow CamelContext and routes to startup
> in situations where a producer may otherwise fail during sta [...]
> > diff --git
> a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
> b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
> > index 94e488c..5d75290 100644
> > ---
> a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
> > +++
> b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
> > @@ -64,6 +64,7 @@ public class ServiceBusConfiguration implements
> Cloneable {
> >      @Metadata(autowired = true)
> >      private ServiceBusReceiverAsyncClient receiverAsyncClient;
> >      @UriParam(label = "consumer")
> > +    @Metadata(required = true)
> >      private String subscriptionName;
> >      @UriParam(label = "consumer")
> >      private boolean disableAutoComplete;
> > diff --git
> a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
> b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
> > index 6fd7564..7c5794c 100644
> > ---
> a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
> > +++
> b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
> > @@ -572,6 +572,7 @@ public interface ServiceBusEndpointBuilderFactory {
> >           *
> >           * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt;
> type.
> >           *
> > +         * Required: true
> >           * Group: consumer
> >           *
> >           * @param subscriptionName the value to set
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Reply via email to