package com.heroku.myorchestrator.consumers;

import com.heroku.myorchestrator.util.actions.SnapshotUtil;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.bson.Document;

public abstract class SnapshotRouteBuilder extends ConsumerRouteBuilder {

    @Override
    public void configure() throws Exception {
        from(ironmqUtil.snapshot().consumeUri())
                .routeId(routeUtil.id())
                .filter(routeUtil.camelBatchComplete())
                .process(defaultProcessor())
                .to(ironmqUtil.diff().postUri());
    }

    protected Processor defaultProcessor() {
        return (Exchange exchange) -> {
            Document document = doSnapshot(new Document());
            new SnapshotUtil(exchange)
                    .saveDocument(document)
                    .updateMessage(document);
        };
    }

    protected abstract Document doSnapshot(Document document) throws Exception;

}

@@ -270,16 +270,89 @@
 lder %7B%0A%0A
+    public SnapshotRouteBuilder() %7B%0A        routeUtil.snapshot();%0A    %7D%0A%0A
     @Ove

modify routeUtil not set ActionType on SnapshotRouteBuilder