How to read properties from CamelContext in a Camel route

Solution Verified - Updated -

Issue

  • I would like to read a property set in CamelContext using Camel's DSL language.
  • In Route #1 I will call a Java method where I will set a property "ABC" into exchange.getContext().setProperties(). In the same CamelContext Route #2 I would like to read the property value.
  • I tried both of the following options, but they did not work:

    <simple>{{ABC}} == 'true'</simple>
    

    or:

    <simple>${properties:ABC} == 'true'</simple>
    
  • The Simple expression "${property.ABC}" does not work, as it refers to a property stored in Exchange, not in CamelContext.

Environment

  • Red Hat JBoss Fuse (Fuse)
    • 6.x
  • Red Hat JBoss Fuse Service Works (FSW)
    • 6.0.x
  • Apache Camel

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.