@Override
	public void handleMessage(Message<?> message) throws MessagingException {
		Object payload = message.getPayload();
		if (payload == startMessage || startMessage.equals(payload)) {
			start = System.currentTimeMillis();
		}
		else if (payload == endMessage || endMessage.equals(payload)) {
			end = System.currentTimeMillis();
			elapsed = end - start;
			String unit;
			switch (sampleUnit) {
				case SECONDS:
					throughput = (long) (counter.get() / (elapsed / 1000));
					unit = "s";
					break;
				case NANOSECONDS:
					throughput = (long) (counter.get() / (elapsed * 1000000));
					unit = "ns";
					break;
				default:
					throughput = (long) (counter.get() / elapsed);
					unit = "ms";
			}

			log.info("Throughput sampled for {} items: {}/{} in {}ms elapsed time.",
					counter.get(),
					throughput,
					unit,
					(long) elapsed);

			resetCounter();
		}
		else if (start > 0) {
			counter.incrementAndGet();
		}
	}
Create a {@literal ThroughputSamplerMessageHandler} using the {@code String} {@literal START} as the start
message and the {@code String} {@literal END} as the end message and measure throughput in seconds.
extensions/spring-xd-extension-throughput/src/main/java/org/springframework/xd/integration/throughput/ThroughputSamplerMessageHandler.java