How to use resources

Resource usages

Resources for initial configuration

Resources are files that contain information that you want to add into the deployment. For example, you can have a resource that lists the currencies used in a payment-related application. In this case, the resource is manually injected.

The route definition would be:

<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

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

Related Links