Hi I think if we want to go with ‘?’ as a marker for the optional parameter then that question mark could be better put at the end of parameter name:
from("jms:cheese?concurrentConsumers={{speedUp?}}") Like it’s the case in TS: https://www.typescriptlang.org/docs/handbook/functions.html#optional-and-default-parameters <https://www.typescriptlang.org/docs/handbook/functions.html#optional-and-default-parameters> It’s also the same syntax for optional chaining in JS itself: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining> Babak > On 5 Mar 2021, at 15:04, Claus Ibsen <claus.ib...@gmail.com> wrote: > > Hi > > In Camel 3.9 we are introducing optional property placeholders. > https://issues.apache.org/jira/browse/CAMEL-16302 > > The use-case is to allow configuring Camel endpoints (primarily) where > you can specify some options that may be configured or not (optional). > > Currently all property placeholders are mandatory, unless a default > value is provided. So with the default value, you could do "optional" > but then you would need to know what the default value would be (if > there is any). > > Optional placeholders is also a feature that we want to have with > route templates (aka Kamelets). So you can create kamelets with a > number of options (some are required, and others would be optional). > And others have default values etc. > > The syntax for marking a property placeholder as option is to prefix > the key name with ?, eg > > from("jms:cheese?concurrentConsumers={{?speedUp}}") > > Here the concurrent consumers option is optional, as the placeholder > value starts with a ? in the key name. > > Then the Camel end user can configure the property placeholder, such > as in application.properties > > speedUp=5 > > Or if there are no configuration, then the option is not present and > the endpoint is resolved as: > > from("jms:cheese") > > > The syntax with the ? mark was choose to keep it short. But we are > open for feedback. > Another alternative was to prefix with optional: > > {{optional:speedUp}} > > However the properties component in Camel then assume the key is named > optional, and the default value is speedUp. So it clashes with this. > But we could make "optional" a reserved word and do special handling > for this. > > The only concern about using ? is that an endpoint uri already have ? > for query parameters. And if using more ? would be confusing? > > > from("jms:cheese?concurrentConsumers={{?speedUp}}&subscrtiptionName={{someName}}") > > Any thoughts? > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2