title: Count the requests processed by a Mule flow
body: <p>I'm using Mule ESB 3.4. I want to develop a custom Java component that counts how many requests are received by a flow. The flow would e.g. be something like this:</p>
  
  <pre><code>http inbound-endpoint -&gt; counter -&gt; vm-outbound-endpoint
  </code></pre>
  
  <p>First of all, the actual variable containing the counter should be stored in memory. Then it might be printed to the log or inserted into a DB (It's not important for now). What I'm after is a clean design that I can later re-use to store a more complex application-global state (based on the number and the content of received messages) and implement a more complex logic.</p>