public static void createAsyncEventQueue(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, String asyncListenerClass, String substitutionFilterClass) throws Exception { createDiskStore(asyncChannelId, diskStoreName); AsyncEventQueueFactory factory = getInitialAsyncEventQueueFactory(isParallel, maxMemory, batchSize, isPersistent, diskStoreName); factory.setDiskSynchronous(isDiskSynchronous); factory.setBatchConflationEnabled(isConflation); if (substitutionFilterClass != null) { factory.setGatewayEventSubstitutionListener( (GatewayEventSubstitutionFilter) getClass(substitutionFilterClass).newInstance()); } // set dispatcher threads factory.setDispatcherThreads(numDispatcherThreadsForTheRun); AsyncEventQueue asyncChannel = factory.create(asyncChannelId, (AsyncEventListener) getClass(asyncListenerClass).newInstance()); }
asyncEventQueueFactory.setGatewayEventSubstitutionListener( (GatewayEventSubstitutionFilter<?, ?>) newInstance(gatewaySubstitutionFilter));
private void endAsyncEventQueue() { AsyncEventQueueCreation asyncEventChannelCreation = (AsyncEventQueueCreation) stack.peek(); AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory(); factory.setParallel(asyncEventChannelCreation.isParallel()); factory.setBatchSize(asyncEventChannelCreation.getBatchSize()); factory.setBatchTimeInterval(asyncEventChannelCreation.getBatchTimeInterval()); factory.setBatchConflationEnabled(asyncEventChannelCreation.isBatchConflationEnabled()); factory.setPersistent(asyncEventChannelCreation.isPersistent()); factory.setDiskStoreName(asyncEventChannelCreation.getDiskStoreName()); factory.setDiskSynchronous(asyncEventChannelCreation.isDiskSynchronous()); factory.setMaximumQueueMemory(asyncEventChannelCreation.getMaximumQueueMemory()); factory.setDispatcherThreads(asyncEventChannelCreation.getDispatcherThreads()); factory.setOrderPolicy(asyncEventChannelCreation.getOrderPolicy()); factory.setForwardExpirationDestroy(asyncEventChannelCreation.isForwardExpirationDestroy()); List<GatewayEventFilter> gatewayEventFilters = asyncEventChannelCreation.getGatewayEventFilters(); for (GatewayEventFilter gatewayEventFilter : gatewayEventFilters) { factory.addGatewayEventFilter(gatewayEventFilter); } factory.setGatewayEventSubstitutionListener( asyncEventChannelCreation.getGatewayEventSubstitutionFilter()); AsyncEventQueue asyncEventChannel = factory.create(asyncEventChannelCreation.getId(), asyncEventChannelCreation.getAsyncEventListener()); stack.pop(); }
.thenAnswer(newSetter(forwardExpirationDestroy, mockAsyncEventQueueFactory)); when(mockAsyncEventQueueFactory.setGatewayEventSubstitutionListener(any(GatewayEventSubstitutionFilter.class))) .thenAnswer(newSetter(gatewayEventSubstitutionFilter, mockAsyncEventQueueFactory));