Unable to set threadPool rejectedPolicy element via property
Environment
- Fuse ESB 7.1
Issue
We are trying to use the threadPool blueprint DSL but are hitting a problem with trying to use a property value for the rejectedPolicy:
<threadPool id="uploadWmsFtpThreadPool" poolSize="{{uploadWmsFtpThreadPool.poolSize}}" threadName="Upload Wms Ftp Thread processor" maxQueueSize="{{uploadWmsFtpThreadPool.maxQueueSize}}" rejectedPolicy="{{uploadWmsFtpThreadPool.rejectedPolicy}}" />
and the following error is in the logs:
Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value '{{uploadWmsFtpThreadPool.rejectedPolicy}}' is not facet-valid with respect to enumeration '[Abort, CallerRuns, DiscardOldest, Discard]'. It must be a value from the enumeration.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)[:]
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)[:]
at org.apache.xerces.jaxp.validation.DOMValidatorHelper.beginNode(Unknown Source)[:]
at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source)[:]
at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source)[:]
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)[:]
at javax.xml.validation.Validator.validate(Unknown Source)[:2.0.0.fuse-71-047]
at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:285)[7:org.apache.aries.blueprint.core:1.0.1.fuse-71-047]
... 22 more
Resolution
rejectedPolicy element is an enum type and {{}} cannot be supported, we can only support xs:string type for it. However there's a work around it [1] from camel 2.11.1 or 2.10.5 onwards where you can set a dummy value for the option and then add:
prop:rejectedPolicy="{{xxx}}"
to override the value. Not to mention that the namespace:
xmlns:prop="http://camel.apache.org/schema/placeholder"
needs to be added on top of the blueprint DSL.
[1] - see section: Using property placeholders for any kind of attribute in the XML DSL
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
