use of org.infinispan.query.api.continuous.ContinuousQuery in project camel by apache.
the class InfinispanConsumer method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
manager.start();
cache = manager.getCache();
if (configuration.hasQueryBuilder()) {
if (InfinispanUtil.isRemote(cache)) {
RemoteCache<Object, Object> remoteCache = InfinispanUtil.asRemote(cache);
Query query = InfinispanRemoteOperation.buildQuery(configuration.getQueryBuilder(), remoteCache);
continuousQuery = Search.getContinuousQuery(remoteCache);
continuousQuery.addContinuousQueryListener(query, new ContinuousQueryEventListener(cache.getName()));
} else {
throw new IllegalArgumentException("Can't run continuous queries against embedded cache (" + cache.getName() + ")");
}
} else {
if (manager.isCacheContainerEmbedded()) {
consumerHandler = InfinispanConsumerEmbeddedHandler.INSTANCE;
} else if (manager.isCacheContainerRemote()) {
consumerHandler = InfinispanConsumerRemoteHandler.INSTANCE;
} else {
throw new UnsupportedOperationException("Unsupported CacheContainer type " + manager.getCacheContainer().getClass().getName());
}
listener = consumerHandler.start(this);
}
}
Aggregations