com.github.lontime.extredisson.service.BatchProvider Maven / Gradle / Ivy
The newest version!
package com.github.lontime.extredisson.service;
import java.util.List;
import com.github.lontime.base.commonj.result.ProcessResult;
import com.github.lontime.base.logging.GLogger;
import com.github.lontime.base.serial.model.Message;
import com.github.lontime.extredisson.configuration.ProducerOption;
import com.github.lontime.extredisson.listener.HandlerInterface;
/**
* BatchProvider.
*
* @author lontime
* @since 1.0
*/
public interface BatchProvider extends AutoCloseable {
/**
* getName.
*
* @return String
*/
String getName();
/**
* close.
*/
@Override
default void close() {
GLogger.defaults().warn(getClass(), "close");
}
/**
* call.
*
* @param messages messages
* @return list
*/
default List call(List messages) {
return call(ProducerOption.topic(), messages);
}
/**
* call.
*
* @param option option
* @param messages messages
* @return list
*/
default List call(ProducerOption option, List messages) {
return call(option, messages, ctx -> ProcessResult.createSuccess());
}
/**
* call.
*
* @param messages messages
* @param handler * @param recheckHandler re-check
* @return list
*/
default List call(List messages, HandlerInterface handler) {
return call(ProducerOption.topic(), messages, handler);
}
/**
* call.
*
* @param name option
* @param messages messages
* @param handler handler
* @return list
*/
List call(String name, List messages, HandlerInterface handler);
/**
* call.
*
* @param option option
* @param messages messages
* @param handler handler
* @return list
*/
List call(ProducerOption option, List messages, HandlerInterface handler);
}