Search in sources :

Example 1 with CdcConsumerState

use of org.apache.ignite.internal.cdc.CdcConsumerState in project ignite by apache.

the class AbstractCdcTest method createCdc.

/**
 */
protected CdcMain createCdc(CdcConsumer cnsmr, IgniteConfiguration cfg, CountDownLatch latch, GridAbsPredicate... conditions) {
    CdcConfiguration cdcCfg = new CdcConfiguration();
    cdcCfg.setConsumer(cnsmr);
    cdcCfg.setKeepBinary(keepBinary());
    cdcCfg.setMetricExporterSpi(metricExporters());
    return new CdcMain(cfg, null, cdcCfg) {

        @Override
        protected CdcConsumerState createState(Path stateDir) {
            return new CdcConsumerState(stateDir) {

                @Override
                public void save(WALPointer ptr) throws IOException {
                    super.save(ptr);
                    if (!F.isEmpty(conditions)) {
                        for (GridAbsPredicate p : conditions) {
                            if (!p.apply())
                                return;
                        }
                        latch.countDown();
                    }
                }
            };
        }
    };
}
Also used : Path(java.nio.file.Path) CdcConsumerState(org.apache.ignite.internal.cdc.CdcConsumerState) GridAbsPredicate(org.apache.ignite.internal.util.lang.GridAbsPredicate) CdcMain(org.apache.ignite.internal.cdc.CdcMain) WALPointer(org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer)

Aggregations

Path (java.nio.file.Path)1 CdcConsumerState (org.apache.ignite.internal.cdc.CdcConsumerState)1 CdcMain (org.apache.ignite.internal.cdc.CdcMain)1 WALPointer (org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer)1 GridAbsPredicate (org.apache.ignite.internal.util.lang.GridAbsPredicate)1