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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content