Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Ce contenu n'est pas disponible dans la langue sélectionnée.
12.4. Configuration Tips and Tricks
12.4.1. Defining Default Value for a Property Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
When you define a property, you can provide a default value for it. To define this default value, append the default value to the property name, separated by a colon (:). For example:
${server.port:8080}
${server.port:8080}
12.4.2. Defining Environment Properties Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
12.4.2.1. Environment Properties as Component Properties Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can define properties as component properties. This way of defining properties is not dynamic, but you can override each property defined here, by properties defined in a prioritized scope.
12.4.2.2. Environment Properties as Composite Properties Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can define properties as composite properties. This way of defining properties is not dynamic, but you can override every property defined here, by properties defined in a prioritized scope.
12.4.2.3. Environment Properties as Domain Properties Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can define properties as composite properties. This way of defining properties is not dynamic, but you can override each property defined here, by properties defined in a prioritized scope.
12.4.2.4. Environment Properties in a Static or Dynamic Module Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can externalize properties from the SwitchYard application by defining them outside the
switchyard.xml
file. For example, inside a module. For this to work, you need to define your module as shown below:
Once you define your module, use these properties in your SwitchYard application as shown below:
12.4.2.5. Environment Properties as OS Environment Properties Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can load properties from OS environment properties. Every environment property is accessible by prefixing it with env. For example, in bash, you can use a property defined as
export MY_PROPERTY=test
, in your SwitchYard application as shown below:
<ftp:binding.sftp> <ftp:host>${env.MY_PROPERTY}</ftp:host> .... </ftp:binding.sftp>
<ftp:binding.sftp>
<ftp:host>${env.MY_PROPERTY}</ftp:host>
....
</ftp:binding.sftp>
12.4.2.6. Environment Properties as Application Server Properties from AS Configuration Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
Application server has the ability to define properties directly in its configuration either by file or with the console. This configuration is dynamically updated and persisted.
Add the configuration to the server definition as shown below:
This property is used in your SwitchYard application as:
12.4.2.7. Environment Properties as Application Server Properties from File Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can pass a properties file as an argument to JBoss Application Server (AS) startup script to load all the properties in the file and make them accessible. You can start the AS as shown below:
$./standalone.sh -P file:///data/production.properties
$./standalone.sh -P file:///data/production.properties
Here are some alternatives:
- -P=<url>: Load system properties from the given URL
- -P<url>: Load system properties from the given URL
- --properties=<url>: Load system properties from the given URL
In your SwitchYard application, you can use these properties as:
12.4.3. Loading Properties for Test Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
In tests, you can add and resolve properties at the top level. The PropertyMixIn eases working with properties:
In case you need access to the PropertyResolver for tests, where a MixIn is not applicable, you can use TestPropertyResolver.INSTANCE and avoid setting command line parameters as shown below:
TestPropertyResolver.INSTANCE.getMap().put("name","value");
TestPropertyResolver.INSTANCE.getMap().put("name","value");