Any variable from the mule flow can be accessed inside a Component by using the
muleMessage.getInvocationProperty("counter");
muleMessage can be obtained from MuleEventContext
of the onCall(MuleEventContext arg0)
method. Assuming that you have implemented Callable
interface of mule.
If not, try getting the message from org.mule.RequestContext.getEvent().getMessage()
This is RequestContext is deprecated as of now.
Hope this helps.