diff --git a/src/main/java/io/github/ithamal/queue/config/ConsumerSetting.java b/src/main/java/io/github/ithamal/queue/config/ConsumerSetting.java index 39b4ce9..ce45c50 100644 --- a/src/main/java/io/github/ithamal/queue/config/ConsumerSetting.java +++ b/src/main/java/io/github/ithamal/queue/config/ConsumerSetting.java @@ -37,8 +37,11 @@ public class ConsumerSetting { private String implClass; public void afterProperties() { - Assert.notNull(queue, "A property 'queue' of consumer setting isn't specified"); - Assert.notNull(implClass, "A property 'implClass' of consumer setting isn't specified"); + Assert.notNull(queue, "A property 'queue' of consumer setting isn't specified."); + Assert.notNull(implClass, "A property 'implClass' of consumer setting isn't specified."); + Assert.isTrue(pollSize == null || pollSize > 0, "A property 'pollSize' of consumer setting must be greater than 0."); + Assert.isTrue(pollInterval == null || pollInterval >= 0, "A property 'pollInterval' of consumer setting must not be negative."); + Assert.isTrue(consumerNum == null || consumerNum > 0, "A property 'consumerNum' of consumer setting must be greater than 0."); name = name != null ? name : queue; groupName = groupName != null ? groupName : "default"; prefix = prefix != null ? prefix : "queue:"; diff --git a/src/main/java/io/github/ithamal/queue/config/ProducerSetting.java b/src/main/java/io/github/ithamal/queue/config/ProducerSetting.java index c7ca37e..276fd01 100644 --- a/src/main/java/io/github/ithamal/queue/config/ProducerSetting.java +++ b/src/main/java/io/github/ithamal/queue/config/ProducerSetting.java @@ -31,9 +31,10 @@ public class ProducerSetting { private Integer nodeId; public void afterProperties() { - Assert.notNull(queue, "A property 'queue' of producer setting isn't specified."); - Assert.notNull(implClass, "A property 'implClass' of producer setting isn't specified."); - Assert.isTrue(nodeId == null || nodeId < 16383, "A property 'nodeId' of producer setting must less than 16383."); + Assert.notNull(queue, "A property 'queue' of producer setting isn't specified."); + Assert.notNull(implClass, "A property 'implClass' of producer setting isn't specified."); + Assert.isTrue(nodeId == null || (nodeId >= 0 && nodeId <= 16383), "A property 'nodeId' of producer setting must be between 0 and 16383."); + Assert.isTrue(reserveDays >= 0, "A property 'reserveDays' of producer setting must not be negative."); name = name != null ? name : queue; prefix = prefix != null ? prefix : "queue:"; serializer = serializer != null ? serializer : "json";