@Override public Collection<Partition> doWithRetry(RetryContext context) throws Exception {
							connectionFactory.refreshMetadata(Collections.singleton(topicName));
							Collection<Partition> partitions = connectionFactory.getPartitions(topicName);
							if (expectedNumber > 0 && partitions.size() < expectedNumber) {
								throw new IllegalStateException(
										"The number of expected partitions was: " + expectedNumber + ", but "
												+ partitions.size() + " have been found instead");
							}
							connectionFactory.getLeaders(partitions);
							return partitions;
						}
Fetches partition data, throwing an exception if the expected number is not met after a number of
subsequent retries
@param topicName topic
@param expectedNumber expected number of partitions. If less or equal to 0, check is suppressed.
@return the partitions
spring-xd-messagebus-kafka/src/main/java/org/springframework/xd/dirt/integration/kafka/KafkaMessageBus.java