Search in sources :

Example 1 with TransformationObserver

use of cz.o2.proxima.direct.transform.TransformationObserver in project proxima-platform by O2-Czech-Republic.

the class ReplicationController method runTransform.

private void runTransform(String name, TransformationDescriptor transform, DirectAttributeFamilyDescriptor family) {
    final StorageFilter filter = transform.getFilter();
    final String consumer = transform.getConsumerNameFactory().apply();
    final CommitLogReader reader = family.getCommitLogReader().orElseThrow(() -> new IllegalStateException("Unable to get reader for family " + family.getDesc().getName() + "."));
    final TransformationObserver observer;
    if (transform.getTransformation().isContextual()) {
        DirectElementWiseTransform transformation = transform.getTransformation().as(DirectElementWiseTransform.class);
        observer = contextualObserver(dataOperator, name, transformation, transform.getOutputTransactionMode() == OutputTransactionMode.ENABLED, filter);
    } else {
        ElementWiseTransformation transformation = transform.getTransformation().asElementWiseTransform();
        observer = nonContextualObserver(dataOperator, name, transformation, transform.getOutputTransactionMode() == OutputTransactionMode.ENABLED, filter);
    }
    startTransformationObserverUsing(consumer, reader, observer);
    log.info("Started transformer {} reading from {} using {}", consumer, reader.getUri(), transform.getTransformation().getClass());
}
Also used : ElementWiseTransformation(cz.o2.proxima.transform.ElementWiseTransformation) StorageFilter(cz.o2.proxima.storage.StorageFilter) DirectElementWiseTransform(cz.o2.proxima.direct.transform.DirectElementWiseTransform) CommitLogReader(cz.o2.proxima.direct.commitlog.CommitLogReader) TransformationObserver(cz.o2.proxima.direct.transform.TransformationObserver)

Example 2 with TransformationObserver

use of cz.o2.proxima.direct.transform.TransformationObserver in project proxima-platform by O2-Czech-Republic.

the class ReplicationControllerTest method testTransformationObserverRetryable.

@Test
public void testTransformationObserverRetryable() {
    TransformationObserver observer = new TransformationObserver.NonContextual(direct, null, null, true, null);
    assertTrue(observer.onError(new IllegalArgumentException()));
}
Also used : TransformationObserver(cz.o2.proxima.direct.transform.TransformationObserver) Test(org.junit.Test)

Aggregations

TransformationObserver (cz.o2.proxima.direct.transform.TransformationObserver)2 CommitLogReader (cz.o2.proxima.direct.commitlog.CommitLogReader)1 DirectElementWiseTransform (cz.o2.proxima.direct.transform.DirectElementWiseTransform)1 StorageFilter (cz.o2.proxima.storage.StorageFilter)1 ElementWiseTransformation (cz.o2.proxima.transform.ElementWiseTransformation)1 Test (org.junit.Test)1