use of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig in project databus by linkedin.
the class SimpleFileLoggingConsumer method createServerSideFilterConfig.
private DbusKeyCompositeFilterConfig createServerSideFilterConfig(String filterConfFile, Properties startupProps) throws IOException, InvalidConfigException {
Boolean cmdLineHasFilterConfig = hasServerSideFilterConfig(startupProps);
if (filterConfFile != null || cmdLineHasFilterConfig) {
Properties props;
// cmdline override the config file
if (cmdLineHasFilterConfig) {
props = startupProps;
} else {
LOG.info("filterConfFile = " + filterConfFile);
props = new Properties();
FileInputStream filterConfStream = new FileInputStream(filterConfFile);
try {
props.load(filterConfStream);
} finally {
filterConfStream.close();
}
}
DbusKeyCompositeFilterConfig.Config conf = new DbusKeyCompositeFilterConfig.Config();
ConfigLoader<DbusKeyCompositeFilterConfig.StaticConfig> filterConfigLoader = new ConfigLoader<DbusKeyCompositeFilterConfig.StaticConfig>(SERVER_SIDE_FILTER_PREFIX, conf);
DbusKeyCompositeFilterConfig.StaticConfig sConf = filterConfigLoader.loadConfig(props);
return new DbusKeyCompositeFilterConfig(sConf);
} else {
return null;
}
}
use of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig in project databus by linkedin.
the class SimpleFileLoggingConsumer method mainFunction.
public void mainFunction(String[] args) throws Exception {
String[] leftOverArgs = processLocalArgs(args);
Properties startupProps = DatabusHttpClientImpl.processCommandLineArgs(leftOverArgs);
DatabusHttpClientImpl.Config clientConfigBuilder = new DatabusHttpClientImpl.Config();
clientConfigBuilder.getContainer().setIdFromName(MODULE + ".localhost");
if (_enableBootStrap) {
clientConfigBuilder.getRuntime().getBootstrap().setEnabled(true);
}
ConfigLoader<DatabusHttpClientImpl.StaticConfig> configLoader = new ConfigLoader<DatabusHttpClientImpl.StaticConfig>("databus.client.", clientConfigBuilder);
String[] sources = addSources();
StringBuilder sourcesString = new StringBuilder();
boolean firstSrc = true;
for (String source : sources) {
if (!firstSrc)
sourcesString.append(",");
firstSrc = false;
sourcesString.append(source);
}
if (_httpPort != null) {
startupProps.put("databus.client.container.httpPort", _httpPort);
}
if (_jmxServicePort != null) {
startupProps.put("databus.client.container.jmx.jmxServicePort", _jmxServicePort);
}
if (_checkpointFileRootDir != null) {
startupProps.put("databus.client.checkpointPersistence.fileSystem.rootDirectory", _checkpointFileRootDir);
}
DatabusHttpClientImpl.StaticConfig clientConfig = configLoader.loadConfig(startupProps);
// set up relay
ServerInfoBuilder relayBuilder = clientConfig.getRuntime().getRelay("1");
relayBuilder.setName("DefaultRelay");
if (_relayHost != null) {
relayBuilder.setHost(_relayHost);
}
if (_relayPort != null) {
relayBuilder.setPort(Integer.parseInt(_relayPort));
}
relayBuilder.setSources(sourcesString.toString());
// set up bootstrap
if (_enableBootStrap) {
ServerInfoBuilder bootstrapBuilder = clientConfig.getRuntime().getBootstrap().getService("2");
bootstrapBuilder.setName("DefaultBootstrapServices");
if (_bootstrapHost != null) {
bootstrapBuilder.setHost(_bootstrapHost);
}
if (_bootstrapPort != null) {
bootstrapBuilder.setPort(Integer.parseInt(_bootstrapPort));
}
bootstrapBuilder.setSources(sourcesString.toString());
}
// handler server side filtering, can either pass a config file or set from command line
DbusKeyCompositeFilterConfig filterConfig = createServerSideFilterConfig(_filterConfFile, startupProps);
// set up listeners
DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConfig);
// dump decoded payload values and raw (undecoded) events
DatabusFileLoggingConsumer consumer = createTypedConsumer(_valueDumpFile, _eventDumpFile);
if (_eventPattern != null) {
consumer.setEventPattern(_eventPattern);
}
DatabusRegistration reg = client.register(consumer, sources);
if (!(reg instanceof DatabusV2RegistrationImpl)) {
throw new RuntimeException("Unexpected type for registration Object !!");
}
if (null != filterConfig)
reg.withServerSideFilter(filterConfig);
// add pause processor
try {
client.getProcessorRegistry().register(ConsumerPauseRequestProcessor.COMMAND_NAME, new ConsumerPauseRequestProcessor(null, consumer));
client.getProcessorRegistry().register(ContainerOperationProcessor.COMMAND_NAME, new ContainerOperationProcessor(null, client));
} catch (ProcessorRegistrationConflictException e) {
LOG.error("Failed to register " + ConsumerPauseRequestProcessor.COMMAND_NAME);
}
DatabusClientShutdownThread shutdownThread = new DatabusClientShutdownThread(client);
Runtime.getRuntime().addShutdownHook(shutdownThread);
//this should automatically start the registration
client.startAndBlock();
}
use of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig in project databus by linkedin.
the class DbusRangePartitionedFilterFactory method createServerSideFilter.
@Override
public DbusKeyCompositeFilterConfig createServerSideFilter(DbusClusterInfo cluster, DbusPartitionInfo partition) throws InvalidConfigException {
DbusKeyCompositeFilterConfig.Config compositeConfig = new DbusKeyCompositeFilterConfig.Config();
for (DatabusSubscription s : _subscriptions) {
KeyFilterConfigHolder.Config filterConfig = new KeyFilterConfigHolder.Config();
filterConfig.setType(PartitionType.RANGE.toString());
filterConfig.getRange().setSize(_rangeWidth);
filterConfig.getRange().setPartitions("[" + partition.getPartitionId() + "]");
compositeConfig.setFilter(s.getLogicalSource().getName(), filterConfig);
}
DbusKeyCompositeFilterConfig c = new DbusKeyCompositeFilterConfig(compositeConfig.build());
LOG.info("Generated Mod Partitioned Config for partition (" + partition + ") of cluster (" + cluster + ") is :" + c);
return c;
}
use of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig in project databus by linkedin.
the class MockRemoteExceptionHandler method testRelayFailOver.
@Test(groups = { "small", "functional" })
public void testRelayFailOver() throws Exception {
final Logger log = Logger.getLogger("TestRelayPullThread.testRelayFailOver");
log.setLevel(Level.INFO);
log.info("-------------- start -------------------");
List<String> sources = Arrays.asList("source1");
Properties clientProps = new Properties();
clientProps.setProperty("client.runtime.bootstrap.enabled", "false");
clientProps.setProperty("client.runtime.relay(1).name", "relay1");
clientProps.setProperty("client.runtime.relay(1).port", "10001");
clientProps.setProperty("client.runtime.relay(1).sources", "source1");
clientProps.setProperty("client.runtime.relay(2).name", "relay2");
clientProps.setProperty("client.runtime.relay(2).port", "10002");
clientProps.setProperty("client.runtime.relay(2).sources", "source1");
clientProps.setProperty("client.runtime.relay(3).name", "relay3");
clientProps.setProperty("client.runtime.relay(3).port", "10003");
clientProps.setProperty("client.runtime.relay(3).sources", "source1");
clientProps.setProperty("client.connectionDefaults.eventBuffer.maxSize", "100000");
clientProps.setProperty("client.connectionDefaults.pullerRetries.maxRetryNum", "9");
clientProps.setProperty("client.connectionDefaults.pullerRetries.sleepIncFactor", "1.0");
clientProps.setProperty("client.connectionDefaults.pullerRetries.sleepIncDelta", "1");
clientProps.setProperty("client.connectionDefaults.pullerRetries.initSleep", "1");
DatabusHttpClientImpl client = new DatabusHttpClientImpl("client.", clientProps);
Assert.assertNotNull(client, "client instantiation ok");
final DatabusHttpClientImpl.StaticConfig clientConf = client.getClientStaticConfig();
final DatabusSourcesConnection.StaticConfig srcConnConf = clientConf.getConnectionDefaults();
DatabusHttpClientImpl.RuntimeConfig clientRtConf = clientConf.getRuntime().build();
DbusEventBuffer.StaticConfig bufferConf = clientConf.getConnectionDefaults().getEventBuffer();
DbusEventBuffer relayBuffer = new DbusEventBuffer(bufferConf);
DbusEventBuffer bootstrapBuffer = new DbusEventBuffer(bufferConf);
//we keep the index of the next server we expect to see
AtomicInteger serverIdx = new AtomicInteger(-1);
Set<ServerInfo> relays = clientRtConf.getRelaysSet();
//generate the order in which we should see the servers
List<ServerInfo> relayOrder = new ArrayList<ServerInfo>(relays);
if (log.isInfoEnabled()) {
StringBuilder sb = new StringBuilder();
for (ServerInfo serverInfo : relayOrder) {
sb.append(serverInfo.getName());
sb.append(" ");
}
log.info("Relay order:" + sb.toString());
}
//This guy always fails on /sources
final MockRelayConnection mockFailConn = new MockRelayConnection(null, null, null, serverIdx);
List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
sourcesResponse.add(new IdNamePair(1L, "source1"));
//This guy succeeds on /sources but fails on /register
final MockRelayConnection mockSuccessConn = new MockRelayConnection(sourcesResponse, null, null, serverIdx);
DatabusRelayConnectionFactory mockConnFactory = EasyMock.createMock("mockRelayFactory", DatabusRelayConnectionFactory.class);
//each server should be tried MAX_RETRIES time until all retries are exhausted
for (int i = 0; i < clientConf.getConnectionDefaults().getPullerRetries().getMaxRetryNum() / 3; ++i) {
EasyMock.expect(mockConnFactory.createRelayConnection(serverNameMatcher(serverIdx, relayOrder), EasyMock.<ActorMessageQueue>notNull(), EasyMock.<RemoteExceptionHandler>notNull())).andReturn(mockFailConn);
EasyMock.expect(mockConnFactory.createRelayConnection(serverNameMatcher(serverIdx, relayOrder), EasyMock.<ActorMessageQueue>notNull(), EasyMock.<RemoteExceptionHandler>notNull())).andReturn(mockFailConn);
EasyMock.expect(mockConnFactory.createRelayConnection(serverNameMatcher(serverIdx, relayOrder), EasyMock.<ActorMessageQueue>notNull(), EasyMock.<RemoteExceptionHandler>notNull())).andReturn(mockSuccessConn);
}
EasyMock.replay(mockConnFactory);
List<DatabusSubscription> sourcesSubList = DatabusSubscription.createSubscriptionList(sources);
//Dummy connection object as expected by the puller thread
// Note that in this case, it is ok to pass Set<relays> as all the relays serve the same source
//"source1"
ConnectionStateFactory connStateFactory = new ConnectionStateFactory(sources);
DatabusSourcesConnection sourcesConn = new DatabusSourcesConnection(srcConnConf, sourcesSubList, relays, null, null, null, relayBuffer, bootstrapBuffer, Executors.newCachedThreadPool(), null, null, null, null, null, null, null, mockConnFactory, null, null, null, null, new DbusEventV1Factory(), connStateFactory);
final RelayPullThread relayPuller = new RelayPullThread("RelayPuller", sourcesConn, relayBuffer, connStateFactory, relays, new ArrayList<DbusKeyCompositeFilterConfig>(), !clientConf.getRuntime().getBootstrap().isEnabled(), clientConf.isReadLatestScnOnErrorEnabled(), clientConf.getPullerBufferUtilizationPct(), Integer.MAX_VALUE, ManagementFactory.getPlatformMBeanServer(), new DbusEventV1Factory(), null);
RemoteExceptionHandler mockRemoteExceptionHandler = new MockRemoteExceptionHandler(sourcesConn, relayBuffer, relayPuller);
Field field = relayPuller.getClass().getDeclaredField("_remoteExceptionHandler");
field.setAccessible(true);
field.set(relayPuller, mockRemoteExceptionHandler);
mockFailConn.setCallback(relayPuller);
mockSuccessConn.setCallback(relayPuller);
//Let the show begin
Thread relayPullerThread = new Thread(relayPuller);
relayPullerThread.setDaemon(true);
relayPullerThread.start();
relayPuller.enqueueMessage(LifecycleMessage.createStartMessage());
TestUtil.assertWithBackoff(new ConditionCheck() {
@Override
public boolean check() {
return mockFailConn.getSourcesCallCounter() == 6;
}
}, "failConn: correct number of /sources", 500, log);
Assert.assertEquals(mockFailConn.getRegisterCallCounter(), 0, "failConn: correct number of /register");
Assert.assertEquals(mockFailConn.getStreamCallCounter(), 0, "failConn: correct number of /stream");
TestUtil.assertWithBackoff(new ConditionCheck() {
@Override
public boolean check() {
return mockSuccessConn.getSourcesCallCounter() == 3;
}
}, "successConn: correct number of /sources", 500, log);
Assert.assertEquals(mockSuccessConn.getRegisterCallCounter(), 3, "successConn: correct number of /register");
Assert.assertEquals(mockSuccessConn.getStreamCallCounter(), 0, "successConn: correct number of /stream");
TestUtil.assertWithBackoff(new ConditionCheck() {
@Override
public boolean check() {
return relayPuller.getComponentStatus().getStatus() == DatabusComponentStatus.Status.SUSPENDED_ON_ERROR;
}
}, "puller suspended because of out of retries", 500, log);
EasyMock.verify(mockConnFactory);
relayPuller.enqueueMessage(LifecycleMessage.createShutdownMessage());
relayPuller.awaitShutdown();
log.info("------------ done --------------");
}
use of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig in project databus by linkedin.
the class MockRemoteExceptionHandler method createRelayPullThread.
private static RelayPullThread createRelayPullThread(boolean failRelayConnection, boolean muteTransition, boolean bootstrapEnabled, boolean readLatestScnEnabled, boolean readDataThrowException, boolean readDataException, String exceptionName, int numRetriesOnFellOff, DbusKeyCompositeFilterConfig filterConfig) throws Exception {
List<String> sources = Arrays.asList("source1");
Properties clientProps = new Properties();
if (bootstrapEnabled) {
clientProps.setProperty("client.runtime.bootstrap.enabled", "true");
clientProps.setProperty("client.runtime.bootstrap.service(1).name", "bs1");
clientProps.setProperty("client.runtime.bootstrap.service(1).port", "10001");
clientProps.setProperty("client.runtime.bootstrap.service(1).sources", "source1");
} else {
clientProps.setProperty("client.runtime.bootstrap.enabled", "false");
}
clientProps.setProperty("client.container.jmx.rmiEnabled", "false");
clientProps.setProperty("client.runtime.relay(1).name", "relay1");
clientProps.setProperty("client.runtime.relay(1).port", "10001");
clientProps.setProperty("client.runtime.relay(1).sources", "source1");
clientProps.setProperty("client.runtime.relay(2).name", "relay2");
clientProps.setProperty("client.runtime.relay(2).port", "10002");
clientProps.setProperty("client.runtime.relay(2).sources", "source1");
clientProps.setProperty("client.runtime.relay(3).name", "relay3");
clientProps.setProperty("client.runtime.relay(3).port", "10003");
clientProps.setProperty("client.runtime.relay(3).sources", "source1");
if (readLatestScnEnabled)
clientProps.setProperty("client.enableReadLatestOnRelayFallOff", "true");
clientProps.setProperty("client.connectionDefaults.eventBuffer.maxSize", "100000");
clientProps.setProperty("client.connectionDefaults.pullerRetries.maxRetryNum", "9");
clientProps.setProperty("client.connectionDefaults.pullerRetries.sleepIncFactor", "1.0");
clientProps.setProperty("client.connectionDefaults.pullerRetries.sleepIncDelta", "1");
clientProps.setProperty("client.connectionDefaults.pullerRetries.initSleep", "1");
clientProps.setProperty("client.connectionDefaults.numRetriesOnFallOff", "" + numRetriesOnFellOff);
DatabusHttpClientImpl.Config clientConfBuilder = new DatabusHttpClientImpl.Config();
ConfigLoader<DatabusHttpClientImpl.StaticConfig> configLoader = new ConfigLoader<DatabusHttpClientImpl.StaticConfig>("client.", clientConfBuilder);
configLoader.loadConfig(clientProps);
DatabusHttpClientImpl.StaticConfig clientConf = clientConfBuilder.build();
DatabusSourcesConnection.StaticConfig srcConnConf = clientConf.getConnectionDefaults();
DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConf);
if (bootstrapEnabled)
client.registerDatabusBootstrapListener(new LoggingConsumer(), null, "source1");
Assert.assertNotNull(client, "client instantiation ok");
DatabusHttpClientImpl.RuntimeConfig clientRtConf = clientConf.getRuntime().build();
//we keep the index of the next server we expect to see
AtomicInteger serverIdx = new AtomicInteger(-1);
//generate the order in which we should see the servers
List<ServerInfo> relayOrder = new ArrayList<ServerInfo>(clientRtConf.getRelays());
if (LOG.isInfoEnabled()) {
StringBuilder sb = new StringBuilder();
for (ServerInfo serverInfo : relayOrder) {
sb.append(serverInfo.getName());
sb.append(" ");
}
LOG.info("Relay order:" + sb.toString());
}
List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
sourcesResponse.add(new IdNamePair(1L, "source1"));
Map<Long, List<RegisterResponseEntry>> registerSourcesResponse = new HashMap<Long, List<RegisterResponseEntry>>();
List<RegisterResponseEntry> regResponse = new ArrayList<RegisterResponseEntry>();
regResponse.add(new RegisterResponseEntry(1L, (short) 1, SCHEMA$.toString()));
registerSourcesResponse.put(1L, regResponse);
ChunkedBodyReadableByteChannel channel = EasyMock.createMock(ChunkedBodyReadableByteChannel.class);
if (!readDataException) {
EasyMock.expect(channel.getMetadata(EasyMock.<String>notNull())).andReturn(null).anyTimes();
} else {
EasyMock.expect(channel.getMetadata(EasyMock.<String>notNull())).andReturn(exceptionName).anyTimes();
}
EasyMock.replay(channel);
DbusEventBuffer dbusBuffer = EasyMock.createMock(DbusEventBuffer.class);
EasyMock.expect(dbusBuffer.readEvents(EasyMock.<ReadableByteChannel>notNull(), EasyMock.<List<InternalDatabusEventsListener>>notNull(), EasyMock.<DbusEventsStatisticsCollector>isNull())).andReturn(1).anyTimes();
EasyMock.expect(dbusBuffer.getSeenEndOfPeriodScn()).andReturn(1L).anyTimes();
EasyMock.expect(dbusBuffer.getEventSerializationVersion()).andReturn(DbusEventFactory.DBUS_EVENT_V1).anyTimes();
if (readDataThrowException) {
EasyMock.expect(dbusBuffer.readEvents(EasyMock.<ReadableByteChannel>notNull())).andThrow(new RuntimeException("dummy")).anyTimes();
} else {
EasyMock.expect(dbusBuffer.readEvents(EasyMock.<ReadableByteChannel>notNull())).andReturn(1).anyTimes();
}
EasyMock.expect(dbusBuffer.acquireIterator(EasyMock.<String>notNull())).andReturn(null).anyTimes();
dbusBuffer.waitForFreeSpace((int) (clientConf.getConnectionDefaults().getFreeBufferThreshold() * 100.0 / clientConf.getPullerBufferUtilizationPct()));
EasyMock.expectLastCall().anyTimes();
EasyMock.expect(dbusBuffer.getBufferFreeReadSpace()).andReturn(0).anyTimes();
EasyMock.replay(dbusBuffer);
//This guy succeeds on /sources but fails on /register [FIXME: it does? why?]
Map<Long, List<RegisterResponseEntry>> registerKeysResponse = null;
List<RegisterResponseMetadataEntry> registerMetadataResponse = null;
MockRelayConnection mockSuccessConn = new MockRelayConnection(sourcesResponse, registerSourcesResponse, registerKeysResponse, registerMetadataResponse, channel, serverIdx, muteTransition);
DatabusRelayConnectionFactory mockConnFactory = EasyMock.createMock("mockRelayFactory", DatabusRelayConnectionFactory.class);
if (failRelayConnection) {
EasyMock.expect(mockConnFactory.createRelayConnection(EasyMock.<ServerInfo>notNull(), EasyMock.<ActorMessageQueue>notNull(), EasyMock.<RemoteExceptionHandler>notNull())).andThrow(new RuntimeException("Mock Error")).anyTimes();
} else {
EasyMock.expect(mockConnFactory.createRelayConnection(EasyMock.<ServerInfo>notNull(), EasyMock.<ActorMessageQueue>notNull(), EasyMock.<RemoteExceptionHandler>notNull())).andReturn(mockSuccessConn).anyTimes();
}
List<DatabusSubscription> sourcesSubList = DatabusSubscription.createSubscriptionList(sources);
// Mock Bootstrap Puller
BootstrapPullThread mockBsPuller = EasyMock.createMock("bpt", BootstrapPullThread.class);
mockBsPuller.enqueueMessage(EasyMock.notNull());
EasyMock.expectLastCall().anyTimes();
// Mock Relay Dispatcher
RelayDispatcher mockDispatcher = EasyMock.createMock("rd", RelayDispatcher.class);
mockDispatcher.enqueueMessage(EasyMock.notNull());
EasyMock.expectLastCall().anyTimes();
DatabusSourcesConnection sourcesConn2 = EasyMock.createMock(DatabusSourcesConnection.class);
DatabusSourcesConnection.SourcesConnectionStatus scs = sourcesConn2.new SourcesConnectionStatus();
EasyMock.expect(sourcesConn2.getSourcesNames()).andReturn(Arrays.asList("source1")).anyTimes();
EasyMock.expect(sourcesConn2.getSubscriptions()).andReturn(sourcesSubList).anyTimes();
EasyMock.expect(sourcesConn2.getConnectionConfig()).andReturn(srcConnConf).anyTimes();
EasyMock.expect(sourcesConn2.getConnectionStatus()).andReturn(scs).anyTimes();
EasyMock.expect(sourcesConn2.getLocalRelayCallsStatsCollector()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getInboundEventsStatsCollector()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getRelayCallsStatsCollector()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getUnifiedClientStats()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getRelayConnFactory()).andReturn(mockConnFactory).anyTimes();
EasyMock.expect(sourcesConn2.loadPersistentCheckpoint()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getDataEventsBuffer()).andReturn(dbusBuffer).anyTimes();
if (bootstrapEnabled)
EasyMock.expect(sourcesConn2.isBootstrapEnabled()).andReturn(true).anyTimes();
else
EasyMock.expect(sourcesConn2.isBootstrapEnabled()).andReturn(false).anyTimes();
EasyMock.expect(sourcesConn2.getBootstrapRegistrations()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getBootstrapServices()).andReturn(null).anyTimes();
EasyMock.expect(sourcesConn2.getBootstrapPuller()).andReturn(mockBsPuller).anyTimes();
EasyMock.expect(sourcesConn2.getRelayDispatcher()).andReturn(mockDispatcher).anyTimes();
EasyMock.makeThreadSafe(mockConnFactory, true);
EasyMock.makeThreadSafe(mockDispatcher, true);
EasyMock.makeThreadSafe(mockBsPuller, true);
EasyMock.makeThreadSafe(sourcesConn2, true);
EasyMock.replay(mockConnFactory);
EasyMock.replay(sourcesConn2);
EasyMock.replay(mockDispatcher);
EasyMock.replay(mockBsPuller);
ConnectionStateFactory connStateFactory = new ConnectionStateFactory(sources);
ArrayList<DbusKeyCompositeFilterConfig> filters = new ArrayList<DbusKeyCompositeFilterConfig>();
if (filterConfig != null)
filters.add(filterConfig);
RelayPullThread relayPuller = new RelayPullThread("RelayPuller", sourcesConn2, dbusBuffer, connStateFactory, clientRtConf.getRelaysSet(), filters, srcConnConf.getConsumeCurrent(), srcConnConf.getReadLatestScnOnError(), srcConnConf.getPullerUtilizationPct(), // no threshold for noEventsRest set
0, ManagementFactory.getPlatformMBeanServer(), new DbusEventV1Factory(), null);
RemoteExceptionHandler mockRemoteExceptionHandler = new MockRemoteExceptionHandler(sourcesConn2, dbusBuffer, relayPuller);
Field field = relayPuller.getClass().getDeclaredField("_remoteExceptionHandler");
field.setAccessible(true);
field.set(relayPuller, mockRemoteExceptionHandler);
mockSuccessConn.setCallback(relayPuller);
return relayPuller;
}
Aggregations