public void registerOrDeregisterConsumerWith(String id, boolean register)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Registering or deregistering a Consumer");
WSRPConsumer consumer = getConsumer(id);
if (consumer == null)
{
throw new ConsumerException(CONSUMER_WITH_ID + id + "' doesn't exist!");
}
try
{
if (register)
{
consumer.getProducerInfo().register();
}
else
{
consumer.getProducerInfo().deregister();
}
}
catch (Exception e)
{
// unexpected exception: deactivate the consumer