L.S.,
In ServiceMix 3.x, I don't really see a way to handle this at the moment - you can plug ExchangeListener and things like that into the normalized message router, but those are largely unable to intervene in the actual message from, i.e. there's no way to prevent the target endpoint from being invoked. For ServiceMix 4.x, there are 2 ways this could work - one would be to use an ExchangeListener and reroute the message to your cache provider based on some criterium. If you pass along the original target endpoint in an exchange property or something, the cache provider can invoke the target endpoint when it needs to fill the cache. Cfr. http://servicemix.apache.org/SMX4NMR/10-events.html Another option (basically similar), could be to register a wire (cfr. http://servicemix.apache.org/SMX4NMR/9-interceptors.html), which would transparently route the message to your cache service provider while keeping the original target endpoint setting around in the exchange. This way, you can again use that information to target the right endpoint for filling the cache if necessary. When we implement something like https://issues.apache.org/jira/browse/SMX4NMR-200 in the future, you can probably reduce the number of wires required to a single dynamic wire that knows about the exchanges it needs to cache. Regards, Gert Vanthienen ------------------------ FuseSource Web: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ On Fri, Oct 21, 2011 at 9:15 PM, Matias Urbieta < [email protected]> wrote: > Hi, i would like to implement a transparent solution of caching so > that developer doesn't need to redefine the route because caching is > a non-functional requirement. > After researching a while, i found > org.apache.servicemix.core.InternalEndpointWrapper that works as a > endpoint wrapper. can it be used for implementing an endpoint > decorator? > For example, if i would like to cache exchange messages sent to an > http provider endpoint, i would have to define it as following in the > xbean file: > > <bean class="..CacheWrapper" > > <property name="keyResolver" value="xpath://name" /> > <property name="expirationPolicy" value="..." /> > <property name="endpoint"> > > <http:provider.../> > </property> > </bean> > > where caching logic is defined in process method. > > should i take care for something else? > > I wonder if it can be implemented as a servicemix broker wrapper > instead... > > Thanks in advance > > > -- > > Lic. Mario Matias Urbita > [email protected] > www.fluxit.com.ar Calle 9 #865 > La Plata / Buenos Aires / Argentina > +54 221 4831722 Int:308 >
