How to use resources

Resources are files that contain information that you want to add into the deployment.

Resources for initial configuration

Let's say you have a resource that lists the currencies used in a payment-related application. In this case, the resource is manually injected via a route.

The route definition would look like this:

<routes xmlns="" xmlns:u="">
        <!-- We use a 'direct' component for manual injection -->
        <from uri="direct:SetUpCurrencies" />
        <!-- Absorb them one by one -->
            <to uri="tnd-absorption:CreateCurrency" />

Once the route is started, it's possible to inject the file and configure the currencies

Resources used to create a proper message

The best example is to create a configurable SQL request like described in the JDBC (Databases). It uses the StringTemplate component of Camel.

The string template uses the $ character as markup in order to inject variables. Thus if you need to use the $ sign you need to escape it and use \$ instead

Resources types

Text resources

When you use a text resource, it will be interpreted as a String using the given charset.

Binary resources

Security best practices
You must never upload untrusted files to your installation. Make sure to have every file scanned by an anti-malware software before it can be used in the product.

When you use a binary resource, it will be interpreted as a byte array even if its content is just text.

Related Links