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

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

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

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;
import io.lettuce.core.api.async.RedisTransactionalAsyncCommands;

public class MultiExec implements Operation {

	private final Operation delegate;

	public MultiExec(Operation delegate) {
		this.delegate = delegate;
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public void execute(BaseRedisAsyncCommands commands, Chunk inputs,
			Chunk> outputs) {
		RedisTransactionalAsyncCommands transactionalCommands = (RedisTransactionalAsyncCommands) commands;
		outputs.add((RedisFuture) transactionalCommands.multi());
		delegate.execute(commands, inputs, outputs);
		outputs.add((RedisFuture) transactionalCommands.exec());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy