This page describes how to use the expressions available for metadata lookup

The expression resolver allows for metadata values, as well as a limited amount of other message information to be inserted into configuration to create dynamic values. The screenshot below shows a simple example where a new payload will be added (to a multi-payload message), where the new payload ID will be the metadata value associated with metadata-key.

Expression Resolver Example

Standard Messages

The standard Adaptris Message type has four different expressions for looking up data.

Message Unique ID

This will resolve the current message unique ID.


Message Payload Size

This will resolve the current payload size, in bytes.


Message Payload

This will resolve the current payload in its entirety.


Metadata Keys

If the expression within %message does not start with % then it is treated as a metadata key, and will resolve the associated value. For instance, if you have a metadata key/value pair day=Monday then %message{day} would resolve to Monday.


Multi-Payload Messages

The following expressions is for referencing any given payload within a multi-payload message. This can be particularly useful if you want to keep a history of payload changes; a before and after each service type of thing.


External Resolvers


This resolves values based on the associated environment variable. For example %env{HOSTNAME} will return the value of the environment variable HOSTNAME. If the variable not defined then the variable will be returned as is.


System Properties

This resolver will resolve values based on the associated system property; for example %sysprop{my.sysprop} will return the value of the system property my.sysprop. If the property is not defined then the property name will be returned as is.



The XPath resolver allows for part of an XML payload to be extracted using an XPath expression.



XML Payload
<?xml version="1.0" encoding="utf-8"?>
      <project name="Wikipedia" launch="2001-01-05">
        <edition language="English"></edition>
        <edition language="German"></edition>
        <edition language="French"></edition>
        <edition language="Polish"></edition>
        <edition language="Spanish"></edition>
    <project name="Wiktionary" launch="2002-12-12">
        <edition language="English"></edition>
        <edition language="French"></edition>
        <edition language="Vietnamese"></edition>
        <edition language="Turkish"></edition>
        <edition language="Spanish"></edition>
Resolved Value

Detailed Weather Forecast Report Example with Adapter config and use of Xpath as a Data Input Parameter:

This example will demonstrate the use of xpath expression resolution as a data input parameter. Below is a simple adapter that checks parts of a weather forecast based on a polling interval consumer it then outputs the calls made into simple text file into your adapters subdirectory. For this run you will need to go to openweathermap and sign-up with a free account to recieve an API key that will allow you to succesfully make calls to their API. The next step is to configure a fresh adapter and in the interest of making it easier below is the XML config you will need to copy and paste over whats in your fresh adapter.xml file need in order to make this work:

  <event-handler class="default-event-handler">
    <connection class="null-connection">
    <producer class="null-message-producer">
  <message-error-handler class="null-processing-exception-handler">
  <failed-message-retrier class="no-retries">
      <consume-connection class="null-connection">
      <produce-connection class="null-connection">
          <consumer class="polling-trigger">
            <message-factory class="multi-payload-message-factory">
            <poller class="fixed-interval-poller">
          <service-collection class="service-list">
                <url>,uk&_APPID{API KEY HERE}_&mode=xml</url>
                <response-header-handler class="http-discard-response-headers"/>
                <request-header-provider class="http-no-request-headers"/>
                <authenticator class="http-no-authentication"/>
                <new-payload class="constant-data-input-parameter">
                  <value>                    City: %payload{xpath:current/city/@name}
                    Country: %payload{xpath:current/city/country/text()}
                    Wind Level: %payload{xpath:current/wind/speed/@name}
                    Wind Direction: %payload{xpath:current/wind/direction/@name} 
                    Cloud frequency: %payload{xpath:current/clouds/@name}
                    Temperature: %payload{xpath:current/temperature/@value} %payload{xpath:current/temperature/@unit}
                    Humidity: %payload{xpath:current/humidity/@value}%payload{xpath:current/humidity/@unit}
                    Raining: %payload{xpath:current/precipitation/@mode}
          <producer class="fs-producer">
            <message-factory class="default-message-factory">
            <unique-id>Output File</unique-id>
            <fs-worker class="fs-nio-worker"/>
            <filename-creator class="formatted-filename-creator">
          <produce-exception-handler class="null-produce-exception-handler"/>
          <message-logger class="message-logging-full"/>
  <message-error-digester class="standard-message-error-digester">

Once your adapter is started what you should get is the following on the config page:

The Adapter


The polling consumer: Set at 2 hour intervals


The simple HTTP Get request: Pointing to the correct address (dont forget to update the API Key to your own)

HTTP-Request,uk&_APPID{INSERT API KEY HERE}_&mode=xml

The ‘Add Payload Service’: The Xpath expressions inputting the information we want extracted from the API


The xpath queries:
City: %payload{xpath:current/city/@name}
Country: %payload{xpath:current/city/country/text()}

Wind Level: %payload{xpath:current/wind/speed/@name}
Wind Direction: %payload{xpath:current/wind/direction/@name} 
Cloud frequency: %payload{xpath:current/clouds/@name}

Temperature: %payload{xpath:current/temperature/@value} %payload{xpath:current/temperature/@unit}
Humidity: %payload{xpath:current/humidity/@value}%payload{xpath:current/humidity/@unit}
Raining: %payload{xpath:current/precipitation/@mode}

The Producer: creating the directory you will the weather forecast report in and also the report itself



All this should culminate in a text file being created every 2 hours in the weatherForecastOutput directory with the file name containing the message ID, date, time and title and looking similar to this: Date-2020-09-08-weatherForecast-Hour-09-Minute-34_MsgID-00000000-0000-0000-0000-000000000000 and containing this:

                    City: London
                    Country: GB

                    Wind Level: Gentle Breeze
                    Wind Direction: West-southwest
                    Cloud frequency: overcast clouds

                    Temperature: 297.27 kelvin
                    Humidity: 61%
                    Raining: no


There is a JSONPath resolver within the interlok-json package, which allows JSON data to be extracted from a message payload.



JSON Payload
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      "color": "red",
      "price": 19.95
  "expensive": 10
Resolved Value
    [ "Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien" ]
Tags: advanced