You could use a filter to list a particular subset of messages which matched the filter, but there is no way to limit the list to the first X number of messages.
Why I got the following error, I could run the cli command as "/subsystem=messaging/hornetq-server=default/jms-queue=ClusteredFirstDLQ/:list-messages-as-json(filter=JMSTimestamp > 1512350812632)" successfully?
Caused by: com.agfa.csp.jms.operation.JBossControllerOperationException: "JBAS01
4884: No operation named 'list-messages-as-json(filter=JMSTimestamp > 1512350812
632)' exists at address [
(\"subsystem\" => \"messaging\"),
(\"hornetq-server\" => \"default\"),
(\"jms-queue\" => \"ClusteredFirstDLQ\")
]" on 10.235.59.67
This is more of a question for the Wildfly community as it appears to me that you're attempting to use the management API available via Wildfly. That said, I don't recognize com.agfa.csp.jms.operation.JBossControllerOperationException. That looks like custom exception, and I'm not sure where that would come from.
For what it's worth, I just tried a similar CLI operation in Wildfly 10.1 (just the version I had on hand) and it worked fine.