public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId, "Consumer identity", null);
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName, "ConsumerGroup name", null);
ConsumerGroup group = getConsumerGroup(groupName);
if (group == null)
{
throw new NoSuchRegistrationException("There is no ConsumerGroup named '" + groupName
+ "' to add a Consumer to...");
}
ConsumerSPI consumer = getConsumerSPIById(consumerId);
if (consumer == null)
{
throw new NoSuchRegistrationException("There is no Consumer with identity '" + consumerId
+ "' to add to ConsumerGroup named '" + groupName + "'. Did you create it?");
}
group.addConsumer(consumer);
return consumer;
}