diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java index 8fb0c4491e..2deab5a444 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java @@ -165,6 +165,9 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC throw new InvalidDestinationException( "Cannot use a Temporary destination that has been deleted"); } + if (prefetch < 0) { + throw new JMSException("Cannot have a prefetch size less than zero"); + } } this.session = session;