use of com.moilioncircle.redis.replicator.event.EventListener in project rocketmq-externals by apache.
the class ListenerTest method testEventListenerRetry2.
@Test
public void testEventListenerRetry2() {
Config config = getConfig();
RedisEventProcessor processor = getExceptionProcessor(config);
EventListener eventListener = new RedisEventListener(config, processor);
KeyValuePair pair = new KeyStringValueString();
eventListener.onEvent(null, pair);
}
use of com.moilioncircle.redis.replicator.event.EventListener in project rocketmq-externals by apache.
the class ListenerTest method testEventListenerRetry1.
@Test
public void testEventListenerRetry1() {
Config config = getConfig();
RedisEventProcessor processor = getFailedProcessor(config);
EventListener eventListener = new RedisEventListener(config, processor);
KeyValuePair pair = new KeyStringValueString();
eventListener.onEvent(null, pair);
}
use of com.moilioncircle.redis.replicator.event.EventListener in project rocketmq-externals by apache.
the class RocketMQRedisReplicatorTest method open.
@Test
public void open() throws Exception {
Configure configure = new Configure(properties);
Replicator replicator = new RocketMQRedisReplicator(configure);
final RocketMQRedisProducer producer = new RocketMQRedisProducer(configure);
producer.open();
final AtomicInteger test = new AtomicInteger();
replicator.addEventListener(new EventListener() {
@Override
public void onEvent(Replicator replicator, Event event) {
if (event instanceof KeyValuePair<?, ?>) {
try {
boolean success = producer.send(event);
if (success) {
test.incrementAndGet();
}
} catch (Exception e) {
LOGGER.error("Fail to send KeyValuePair", e);
}
} else if (event instanceof Command) {
try {
boolean success = producer.send(event);
if (success) {
test.incrementAndGet();
}
} catch (Exception e) {
LOGGER.error("Fail to send command", e);
}
}
}
});
replicator.addCloseListener(new CloseListener() {
@Override
public void handle(Replicator replicator) {
producer.close();
}
});
replicator.open();
assertEquals(19, test.get());
}
use of com.moilioncircle.redis.replicator.event.EventListener in project rocketmq-externals by apache.
the class ListenerTest method testEventListener.
@Test
public void testEventListener() {
EventListener eventListener = new RedisEventListener(this.config, processor);
KeyValuePair pair = new KeyStringValueString();
eventListener.onEvent(null, pair);
}
Aggregations