use of cz.o2.proxima.repository.DataOperator 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());
}
use of cz.o2.proxima.repository.DataOperator in project proxima-platform by O2-Czech-Republic.
the class ReplicationController method runTransformer.
private void runTransformer(String name, TransformationDescriptor transform) {
if (transform.getInputTransactionMode() == InputTransactionMode.TRANSACTIONAL) {
log.info("Skipping run of transformation {} which read from transactional attributes {}. " + "Will be executed during transaction commit.", name, transform.getAttributes());
return;
}
DirectAttributeFamilyDescriptor family = transform.getAttributes().stream().map(attr -> getAttributeDescriptorStreamFor(dataOperator, attr).collect(Collectors.toSet())).reduce(Sets::intersection).filter(s -> !s.isEmpty()).flatMap(s -> s.stream().filter(f -> f.getCommitLogReader().isPresent()).findAny()).orElseThrow(() -> new IllegalArgumentException("Cannot obtain attribute family for " + transform.getAttributes()));
runTransform(name, transform, family);
}
Aggregations