use of cbit.vcell.message.VCMessageSelector in project vcell by virtualcell.
the class SimDataServer method init.
public void init() throws Exception {
String dataRequestFilter = "(" + VCMessagingConstants.MESSAGE_TYPE_PROPERTY + "='" + VCMessagingConstants.MESSAGE_TYPE_RPC_SERVICE_VALUE + "') " + " AND (" + VCMessagingConstants.SERVICE_TYPE_PROPERTY + "='" + ServiceType.DATA.getName() + "')";
String exportOnlyFilter = "(" + ServiceType.DATAEXPORT.getName() + " is NOT NULL)";
String dataOnlyFilter = "(" + ServiceType.DATAEXPORT.getName() + " is NULL)";
VCMessageSelector selector;
ServiceType serviceType = serviceInstanceStatus.getType();
int numThreads;
if (serviceType == ServiceType.DATAEXPORT) {
selector = vcMessagingService.createSelector(dataRequestFilter + " AND " + exportOnlyFilter);
numThreads = Integer.parseInt(PropertyLoader.getProperty(PropertyLoader.exportdataThreadsProperty, "3"));
} else if (serviceType == ServiceType.DATA) {
selector = vcMessagingService.createSelector(dataRequestFilter + " AND " + dataOnlyFilter);
numThreads = Integer.parseInt(PropertyLoader.getProperty(PropertyLoader.simdataThreadsProperty, "5"));
} else {
throw new RuntimeException("expecting either Service type of " + ServiceType.DATA + " or " + ServiceType.DATAEXPORT);
}
this.sharedProducerSession = vcMessagingService.createProducerSession();
rpcMessageHandler = new VCRpcMessageHandler(dataServerImpl, VCellQueue.DataRequestQueue);
this.pooledQueueConsumer = new VCPooledQueueConsumer(rpcMessageHandler, numThreads, sharedProducerSession);
this.pooledQueueConsumer.initThreadPool();
rpcConsumer = new VCQueueConsumer(VCellQueue.DataRequestQueue, pooledQueueConsumer, selector, serviceType.getName() + " RPC Server Thread", MessageConstants.PREFETCH_LIMIT_DATA_REQUEST);
vcMessagingService.addMessageConsumer(rpcConsumer);
initControlTopicListener();
}
Aggregations