org.infinispan.hotrod.MutinyToAsyncCacheEntryProcessor Maven / Gradle / Ivy
package org.infinispan.hotrod;
import java.util.concurrent.Flow;
import org.infinispan.api.async.AsyncCacheEntryProcessor;
import org.infinispan.api.common.MutableCacheEntry;
import org.infinispan.api.common.process.CacheEntryProcessorContext;
import org.infinispan.api.common.process.CacheEntryProcessorResult;
import org.infinispan.api.mutiny.MutinyCacheEntryProcessor;
import org.reactivestreams.FlowAdapters;
import io.smallrye.mutiny.Multi;
public class MutinyToAsyncCacheEntryProcessor implements AsyncCacheEntryProcessor {
private final MutinyCacheEntryProcessor mutinyCacheEntryProcessor;
public MutinyToAsyncCacheEntryProcessor(MutinyCacheEntryProcessor mutinyCacheEntryProcessor) {
this.mutinyCacheEntryProcessor = mutinyCacheEntryProcessor;
}
@Override
public Flow.Publisher> process(Flow.Publisher> entries, CacheEntryProcessorContext context) {
return FlowAdapters.toFlowPublisher(mutinyCacheEntryProcessor.process(Multi.createFrom().publisher(FlowAdapters.toPublisher(entries)), context)
.convert().toPublisher());
}
}