Search in sources :

Example 1 with DynamicAbstractExchangeSnapshot

use of com.predic8.membrane.core.exchange.snapshots.DynamicAbstractExchangeSnapshot in project service-proxy by membrane.

the class ElasticSearchExchangeStore method snap.

@Override
public void snap(AbstractExchange exc, Interceptor.Flow flow) {
    AbstractExchangeSnapshot excCopy = null;
    try {
        if (flow == Interceptor.Flow.REQUEST) {
            excCopy = new DynamicAbstractExchangeSnapshot(exc, this::addForElasticSearch);
            addForElasticSearch(excCopy);
        } else {
            excCopy = getExchangeDtoById((int) exc.getId());
            DynamicAbstractExchangeSnapshot.addObservers(exc, excCopy, this::addForElasticSearch);
            excCopy = excCopy.updateFrom(exc);
            addForElasticSearch(excCopy);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DynamicAbstractExchangeSnapshot(com.predic8.membrane.core.exchange.snapshots.DynamicAbstractExchangeSnapshot) AbstractExchangeSnapshot(com.predic8.membrane.core.exchange.snapshots.AbstractExchangeSnapshot) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) DynamicAbstractExchangeSnapshot(com.predic8.membrane.core.exchange.snapshots.DynamicAbstractExchangeSnapshot)

Aggregations

AbstractExchangeSnapshot (com.predic8.membrane.core.exchange.snapshots.AbstractExchangeSnapshot)1 DynamicAbstractExchangeSnapshot (com.predic8.membrane.core.exchange.snapshots.DynamicAbstractExchangeSnapshot)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1