Search in sources :

Example 6 with VCMessageSelector

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();
}
Also used : VCMessageSelector(cbit.vcell.message.VCMessageSelector) ServiceType(cbit.vcell.message.server.bootstrap.ServiceType) VCPooledQueueConsumer(cbit.vcell.message.VCPooledQueueConsumer) VCRpcMessageHandler(cbit.vcell.message.VCRpcMessageHandler) VCQueueConsumer(cbit.vcell.message.VCQueueConsumer)

Aggregations

VCMessageSelector (cbit.vcell.message.VCMessageSelector)6 VCMessage (cbit.vcell.message.VCMessage)4 VCMessageSession (cbit.vcell.message.VCMessageSession)4 VCQueueConsumer (cbit.vcell.message.VCQueueConsumer)3 VCTopicConsumer (cbit.vcell.message.VCTopicConsumer)3 VCMessagingException (cbit.vcell.message.VCMessagingException)2 VCPooledQueueConsumer (cbit.vcell.message.VCPooledQueueConsumer)2 QueueListener (cbit.vcell.message.VCQueueConsumer.QueueListener)2 VCRpcMessageHandler (cbit.vcell.message.VCRpcMessageHandler)2 TopicListener (cbit.vcell.message.VCTopicConsumer.TopicListener)2 FileNotFoundException (java.io.FileNotFoundException)2 MessagePropertyNotFoundException (cbit.vcell.message.MessagePropertyNotFoundException)1 RollbackException (cbit.vcell.message.RollbackException)1 VCellQueue (cbit.vcell.message.VCellQueue)1 VCellTopic (cbit.vcell.message.VCellTopic)1 SimulationTaskMessage (cbit.vcell.message.messages.SimulationTaskMessage)1 ServiceType (cbit.vcell.message.server.bootstrap.ServiceType)1 HtcProxy (cbit.vcell.message.server.htc.HtcProxy)1 SimulationTask (cbit.vcell.messaging.server.SimulationTask)1 HtcJobID (cbit.vcell.server.HtcJobID)1