Thank you for advice! You idea of configuring cache with eip is really good. I never tired to configure it by this way! One attribute on BC is not problem, so Cache will have EIP as destination service.
Regards, Luke Gert Vanthienen wrote: > > Luke, > > The Cache component is used to cache invocation results for a service to > avoid having to call the external service again. As such, it always > sits between the actual service endpoint and the invoker. If you would > move the Cache service, I suppose you would want to cache the invocation > of the Validate call instead of the call to the LogisticsService? Why > not move the cache out entirely then and cache the entire routing slip? > > One way to improve readability/maintainability of your code though, is > by changing the cache component's service/endpoint name, giving it the > same service name as the target service, just another endpoint name. > This way, you can write <eip:target/> with the LogisticsService in your > routing slip; if you want caching, you specify endpoint="cache", > otherwise you use the original endpoint name. > > Regards, > > Gert > > splatch wrote: >> Hello, >> I have simple question about Cache configuration. Normally I must provide >> destinationService attribute for this component, but that isn't nice if >> we >> use EIP routing because in this moment we have inforations about routing >> in >> two places. First is cache configuration, second is eip configuration. >> >> Example configuration below works fine. Target endpoint >> logistic:LogisticService is called only once. Problem is routing >> management. >> If I want change order - move validation after caching - I must change >> configuration in two places. Is there posibility to use only EIP to >> configure cache destinationService? >> >> Logistic namespace prefix value is set to >> http://servicemix.org/services/logistic >> >> cache/servicemix.xml >> <sm:serviceunit id="jbi"> >> <sm:activationSpecs> >> <sm:activationSpec id="LogisticCache" >> endpoint="logistic-cache" >> componentName="LogisticCache" service="logistic:Cache" >> destinationService="logistic:LogisticService"> >> <sm:component> >> <!-- I use Spring to inject CacheComponent --> >> <ref bean="logisticCache" /> >> </sm:component> >> </sm:activationSpec> >> </sm:activationSpecs> >> </sm:serviceunit> >> >> routing/xbean.xml >> <eip:static-routing-slip service="logistic:LogisticRoutingSlip" >> endpoint="logistic-routing"> >> <eip:targets> >> <eip:exchange-target service="logistic:Validate" /> >> <eip:exchange-target service="logistic:Cache" /> >> <!-- I would like define destination here, not above --> >> <!-- <eip:exchange-target service="logistic:LogisticService" >> interface="logistic:LogisticServiceType" /> --> >> </eip:targets> >> </eip:static-routing-slip> >> >> Regards, >> Luke >> > > > > ----- > --- > Gert Vanthienen > http://www.anova.be > -- View this message in context: http://www.nabble.com/Cache-and-EIP-with-static-routing-tp19067601p19103123.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
