private void setMessageRates(DetailedContainer container) {
		String containerHost = container.getAttributes().getIp();
		String containerManagementPort = container.getAttributes().getManagementPort();
		if (StringUtils.hasText(containerManagementPort) && enableMessageRates.equalsIgnoreCase("true")) {
			Map<String, HashMap<String, Double>> messageRates = new HashMap<String, HashMap<String, Double>>();
			String request = String.format("%s%s:%s%s", CONTAINER_HOST_URI_PROTOCOL, containerHost,
					containerManagementPort, JOLOKIA_XD_MODULE_MBEAN_URL);
			try {
				String response = restTemplate.getForObject(request, String.class).toString();
				JSONObject jObject = new JSONObject(response);
				JSONObject value = jObject.getJSONObject("value");
				JSONArray jsonArray = value.names();
				// iterate over each module MBean
				for (int i = 0; i < jsonArray.length(); i++) {
					String mbeanKey = (String) jsonArray.get(i);
					StringTokenizer tokenizer = new StringTokenizer(mbeanKey, ",");
					if (mbeanKey.contains("component=MessageChannel")
							&& (mbeanKey.contains("name=" + INPUT_CHANNEL_NAME)
									|| mbeanKey.contains("name=" + OUTPUT_CHANNEL_NAME))) {
						while (tokenizer.hasMoreElements()) {
							String element = (String) tokenizer.nextElement();
							if (element.startsWith("module=")) {
								String key = String.format("%s", element.substring(element.indexOf("=") + 1));
								HashMap<String, Double> rate = (messageRates.get(key) != null) ? messageRates.get(key)
										: new HashMap<String, Double>();
								Double rateValue = (Double) value.getJSONObject((String) jsonArray.get(i)).get(
										"MeanSendRate");
								if (mbeanKey.contains("name=" + INPUT_CHANNEL_NAME)) {
									rate.put(INPUT_CHANNEL_NAME, rateValue);
								}
								else if (mbeanKey.contains("name=" + OUTPUT_CHANNEL_NAME)) {
									rate.put(OUTPUT_CHANNEL_NAME, rateValue);
								}
								messageRates.put(key, rate);
							}
						}
					}
				}
				container.setMessageRates(messageRates);
			}
			catch (RestClientException e) {
				logger.warn(String.format("Error getting message rate metrics for %s", container.getName()), e);
			}
			catch (JSONException jse) {
				logger.warn(String.format("Error getting message rate metrics for %s", container.getName()), jse);
			}
		}
	}
Set the message rates of all the deployed modules in the given container.

@param container the container to set the message rates
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/rest/ContainersController.java