{
String id = attrs.getValue("id");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "producer identifier", "Configuring a producer");
// check that the consumer doesn't exist in the database first
WSRPConsumer consumer = consumerRegistry.getConsumer(id);
if (consumer != null)
{
String message = "Added consumer for producer '" + id + "' with status: ";
// if consumer is active, add it to the list of services
if (consumer.getProducerInfo().isActive())
{
consumers.put(id, consumer);
message += "active";
}
else
{
message += "inactive";
}
log.info(message + " (loaded from database).");
// consumer already exists, do not further process this producer and use the DB configuration instead
return null;
}
String expirationCache = attrs.getValue("expiration-cache");
Integer expirationCacheSeconds = null;
if (expirationCache != null)
{
try
{
expirationCacheSeconds = new Integer(expirationCache);
}
catch (NumberFormatException e)
{
log.info("Ignoring bad expiration cache value " + expirationCache + " for producer '" + id + "'");
}
}
String wsTimeout = attrs.getValue("ws-timeout");
Integer wsTimeoutMS = ServiceFactory.DEFAULT_TIMEOUT_MS;
if (wsTimeout != null)
{
try
{
wsTimeoutMS = new Integer(wsTimeout);
}
catch (NumberFormatException e)
{
log.info("Ignoring bad WS timeout value " + wsTimeout + " for producer '" + id + "'");
}
}
// consumer didn't exist in the database, so create one and configure it
consumer = consumerRegistry.createConsumer(id, expirationCacheSeconds, null);
consumer.getProducerInfo().getEndpointConfigurationInfo().setWSOperationTimeOut(wsTimeoutMS);
return consumer;
}
else
{