co.com.bancolombia.commons.jms.mq.config.utils.AnnotationUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-jms-mq Show documentation
Show all versions of commons-jms-mq Show documentation
A performant abstraction on top of JMS
package co.com.bancolombia.commons.jms.mq.config.utils;
import co.com.bancolombia.commons.jms.mq.config.MQProperties;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class AnnotationUtils {
public static int resolveRetries(String maxRetriesStr) {
try {
int maxRetries = Integer.parseInt(maxRetriesStr);
if (maxRetries < 0) {
maxRetries = -1;
}
return maxRetries;
} catch (Exception ignored) {
return MQProperties.DEFAULT_MAX_RETRIES;
}
}
public static int resolveConcurrency(int concurrencyAnnotation, int concurrencyProperties) {
if (concurrencyAnnotation > 0) {
return concurrencyAnnotation;
}
if (concurrencyProperties > 0) {
return concurrencyProperties;
}
return MQProperties.DEFAULT_CONCURRENCY;
}
public static String resolve(String fromAnnotation, String defaultValue) {
if (StringUtils.hasText(fromAnnotation)) {
return fromAnnotation;
}
if (StringUtils.hasText(defaultValue)) {
return defaultValue;
}
return "";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy