title: How to use properties with the SimpleRegistry in Apache Camel (Spring XML)
body: <p>I want to use a SimpleRegistry to store properties (as global variables). The property is changed with <code>setProperty</code> in a route with a jms endpoint.  The camel documentation changed last week and has many dead links, also the Registry page. I did not found any samples that describe the use of the simpleRegistry.</p>
  
  <p>I used the <a href="https://github.com/apache/camel/tree/master/examples/camel-example-servlet-tomcat" rel="nofollow noreferrer">camel-example-servlet-tomcat</a> as base. I do not use Fuse or the patched camel wildfly, because is to huge for our simple module.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;beans .... &gt;
     .
     .
     .
    &lt;bean id="simpleRegistry" class="org.apache.camel.support.SimpleRegistry" /&gt;
  
    &lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
      &lt;propertyPlaceholder id="properties" location="ref:simpleRegistry" /&gt;
      &lt;route id="storeConfig"&gt;
        &lt;from id="myTopic" uri="jms:topic:myTopic?selector=Configuration %3D 'xyz'" /&gt;
        &lt;log id="printHeader2" message="Received header: ${headers}" /&gt;
        &lt;log id="logToken" message="Received token: ${headers[myToken]}" /&gt;
        &lt;setProperty id="setMyToken" name="myProperty"&gt;
          &lt;simple&gt;${headers[myToken]}&lt;/simple&gt;
        &lt;/setProperty&gt;
      &lt;/route&gt;
      &lt;route id="externalIncomingDataRoute"&gt;
        &lt;from uri="servlet:hello" /&gt;
        &lt;transform&gt;
              &lt;simple&gt;The Token is: {{myProperty}}&lt;/simple&gt;
        &lt;/transform&gt;
      &lt;/route&gt;
    &lt;/camelContext&gt;
  &lt;/beans&gt;
  
  </code></pre>
  
  <p>With the camel context deined like above, I got a <code>java.io.FileNotFoundException</code> <strong>Properties simpleRegistry not found in registry.</strong></p>
  
  <p>When I use <code>&lt;propertyPlaceholder id="properties" location="classpath:test.properties" /&gt;</code> and create a test.properties file, everything works fine but I cannot change the property. The operation in the <code>setProperty</code> tag is ignored.</p>
  
  <p>The reason why I need a global variable is, I send a dynamic configuration (the myToken) via a jms topic to the camel context. A single route should store this configuration globaly. If an other route is called via an rest component, this route need the token to make a choice.</p>