jbertram commented on code in PR #4824: URL: https://github.com/apache/activemq-artemis/pull/4824#discussion_r1507026878
########## artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ProducerThread.java: ########## @@ -190,6 +195,43 @@ protected Message createMessage(long i, String threadName) throws Exception { answer.setLongProperty("count", i); answer.setStringProperty("ThreadSent", threadName); + + if (properties != null && properties.length() != 0) { + JsonArray propertyArray = JsonLoader.readArray(new StringReader(properties)); + for (int j = 0; j < propertyArray.size(); j++) { + JsonObject propertyEntry = propertyArray.getJsonObject(j); + String type = propertyEntry.getString("type"); + String key = propertyEntry.getString("key"); + String value = propertyEntry.getString("value"); + switch (type) { + case "boolean": + answer.setBooleanProperty(key, Boolean.parseBoolean(value)); + break; + case "int": + answer.setIntProperty(key, Integer.parseInt(value)); + break; + case "long": + answer.setLongProperty(key, Long.parseLong(value)); + break; + case "byte": + answer.setByteProperty(key, Byte.parseByte(value)); + break; + case "short": + answer.setShortProperty(key, Short.parseShort(value)); + break; + case "float": + answer.setFloatProperty(key, Float.parseFloat(value)); + break; + case "double": + answer.setDoubleProperty(key, Double.parseDouble(value)); + break; + case "string": + answer.setStringProperty(key, value); + break; + } Review Comment: Done. I also added a new test to make sure incorrect types are dealt with properly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org