All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redis.spring.batch.writer.operation.AbstractKeyWriteOperation Maven / Gradle / Ivy

The newest version!
package com.redis.spring.batch.writer.operation;

import java.util.function.Function;

import org.springframework.batch.item.Chunk;

import com.redis.spring.batch.common.Operation;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.async.BaseRedisAsyncCommands;

public abstract class AbstractKeyWriteOperation implements Operation {

	private final Function keyFunction;

	protected AbstractKeyWriteOperation(Function keyFunction) {
		this.keyFunction = keyFunction;
	}

	@Override
	public void execute(BaseRedisAsyncCommands commands, Chunk inputs,
			Chunk> outputs) {
		for (I item : inputs) {
			K key = keyFunction.apply(item);
			execute(commands, item, key, outputs);
		}
	}

	protected abstract void execute(BaseRedisAsyncCommands commands, I item, K key,
			Chunk> outputs);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy