Add a warning message for invalid input compression type string

This commit is contained in:
yabinmeng 2024-05-01 20:24:51 -05:00
parent 0c74a442e5
commit 1025b1ddc2

View File

@ -22,6 +22,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.nosqlbench.adapter.s4j.exception.S4JAdapterInvalidParamException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
@ -35,6 +37,8 @@ import java.util.Map;
*/
public class S4JClientConfConverter {
private final static Logger logger = LogManager.getLogger(S4JClientConfConverter.class);
public static Map<String, Object> convertRawClientConf(Map<String, String> pulsarClientConfMapRaw) {
Map<String, Object> s4jClientConfObjMap = new HashMap<>();
s4jClientConfObjMap.putAll(pulsarClientConfMapRaw);
@ -87,6 +91,11 @@ public class S4JClientConfConverter {
};
} catch (IllegalArgumentException e) {
// Any invalid value will be treated as no compression
logger.warn("Invalid producer \"compressionType\" value ({}) in the config properties file. " +
"Expecting one of the following values: {}. " +
"No message compression will be applied (for producers).",
confVal,
S4JAdapterUtil.getValidMsgCompressionTypeList());
}
}