此内容没有您所选择的语言版本。
5.4. Custom Listeners for Embedded Cache
Custom Listeners for an embedded cache can be registered through the
customListener parameter as shown below:
Using Java
from("infinispan://?cacheContainer=#myCustomContainer&cacheName=customCacheName&customListener=#myCustomListener")
.to("mock:result");
Using Blueprint
<bean id="myCustomContainer" org.infinispan.manager.DefaultCacheManager"
init-method="start" destroy-method="stop">
<argument value="infinispan.xml" />
</bean>
<bean id="myCustomListener" class="org.example.com.CustomListener"/>
<camelContext id="route" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="infinispan://?cacheContainer=#myCustomContainer&cacheName=customCacheName&customListener=#myCustomListener"/>
<to uri="mock:result"/>
</route>
</camelContext>
The instance of
myCustomListener must exist. Users are encouraged to extend the org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedCustomListener and annotate the resulting class with the @Listener annotation from org.infinispan.notifications.
Note
Custom filters and converters for embedded caches are currently not supported.