use of nl.nn.adapterframework.statistics.SizeStatisticsKeeper in project iaf by ibissource.
the class PipeLine method configure.
public void configure(IPipe pipe) throws ConfigurationException {
try {
if (pipe instanceof IExtendedPipe) {
IExtendedPipe epipe = (IExtendedPipe) pipe;
// Temporary here because of validators and wrappers
epipe.setPipeLine(this);
if (epipe.getDurationThreshold() >= 0) {
epipe.registerEvent(IExtendedPipe.LONG_DURATION_MONITORING_EVENT);
}
epipe.registerEvent(IExtendedPipe.PIPE_EXCEPTION_MONITORING_EVENT);
if (getMessageSizeWarnNum() >= 0) {
epipe.registerEvent(IExtendedPipe.MESSAGE_SIZE_MONITORING_EVENT);
}
if (epipe.hasSizeStatistics()) {
if (pipe instanceof AbstractPipe) {
AbstractPipe aPipe = (AbstractPipe) pipe;
if (aPipe.getInSizeStatDummyObject() != null) {
pipeSizeStats.put(aPipe.getInSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getInSizeStatDummyObject().getName()));
}
if (aPipe.getOutSizeStatDummyObject() != null) {
pipeSizeStats.put(aPipe.getOutSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getOutSizeStatDummyObject().getName()));
}
} else {
pipeSizeStats.put(pipe.getName(), new SizeStatisticsKeeper(pipe.getName()));
}
}
}
pipe.configure();
for (PipeForward forward : pipe.getForwards().values()) {
String path = forward.getPath();
if (path != null) {
PipeLineExit plExit = getPipeLineExits().get(path);
if (plExit == null && getPipe(path) == null) {
ConfigurationWarnings.add(pipe, log, "has a forward of which the pipe to execute [" + path + "] is not defined");
}
}
}
if (pipe instanceof MessageSendingPipe) {
MessageSendingPipe messageSendingPipe = (MessageSendingPipe) pipe;
if (messageSendingPipe.getMessageLog() != null) {
pipeStatistics.put(messageSendingPipe.getMessageLog().getName(), new StatisticsKeeper(messageSendingPipe.getMessageLog().getName()));
}
}
pipeStatistics.put(pipe.getName(), new StatisticsKeeper(pipe.getName()));
// congestionSensors.addSensor(pipe);
} catch (Throwable t) {
throw new ConfigurationException("Exception configuring " + ClassUtils.nameOf(pipe), t);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "pipe [" + pipe.getName() + "] successfully configured: [" + pipe.toString() + "]");
}
}
use of nl.nn.adapterframework.statistics.SizeStatisticsKeeper in project iaf by ibissource.
the class PipeLine method configure.
/**
* Configures the pipes of this Pipeline and does some basic checks. It also
* registers the <code>PipeLineSession</code> object at the pipes.
* @see IPipe
*/
@Override
public void configure() throws ConfigurationException {
INamedObject owner = getOwner();
Adapter adapter = null;
if (owner instanceof Adapter) {
adapter = (Adapter) owner;
}
if (cache != null) {
cache.configure(owner.getName() + "-Pipeline");
}
for (int i = 0; i < pipes.size(); i++) {
IPipe pipe = getPipe(i);
log.debug(getLogPrefix() + "configuring Pipe [" + pipe.getName() + "]");
// forward is defined, it is not overwritten by the globals
for (String gfName : globalForwards.keySet()) {
PipeForward pipeForward = globalForwards.get(gfName);
pipe.registerForward(pipeForward);
}
if (pipe instanceof FixedForwardPipe) {
FixedForwardPipe ffpipe = (FixedForwardPipe) pipe;
// getSuccessForward will return null since it has not been set. See below configure(pipe)
if (ffpipe.findForward(PipeForward.SUCCESS_FORWARD_NAME) == null) {
int i2 = i + 1;
if (i2 < pipes.size()) {
String nextPipeName = getPipe(i2).getName();
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
pf.setPath(nextPipeName);
pipe.registerForward(pf);
} else {
PipeLineExit plexit = findExitByState(ExitState.SUCCESS);
if (plexit != null) {
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
pf.setPath(plexit.getPath());
pipe.registerForward(pf);
}
}
}
}
configure(pipe);
}
if (pipeLineExits.size() < 1) {
throw new ConfigurationException("no PipeLine Exits specified");
}
if (pipes.isEmpty()) {
throw new ConfigurationException("no Pipes in PipeLine");
}
if (this.firstPipe == null) {
firstPipe = pipes.get(0).getName();
}
if (getPipe(firstPipe) == null) {
throw new ConfigurationException("no pipe found for firstPipe [" + firstPipe + "]");
}
IValidator inputValidator = getInputValidator();
IValidator outputValidator = getOutputValidator();
if (inputValidator != null && outputValidator == null && inputValidator instanceof IDualModeValidator) {
outputValidator = ((IDualModeValidator) inputValidator).getResponseValidator();
setOutputValidator(outputValidator);
}
if (inputValidator != null) {
log.debug(getLogPrefix() + "configuring InputValidator");
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
inputValidator.registerForward(pf);
inputValidator.setName(INPUT_VALIDATOR_NAME);
configure(inputValidator);
}
if (outputValidator != null) {
log.debug(getLogPrefix() + "configuring OutputValidator");
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
outputValidator.registerForward(pf);
outputValidator.setName(OUTPUT_VALIDATOR_NAME);
configure(outputValidator);
}
if (getInputWrapper() != null) {
log.debug(getLogPrefix() + "configuring InputWrapper");
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
getInputWrapper().registerForward(pf);
getInputWrapper().setName(INPUT_WRAPPER_NAME);
configure(getInputWrapper());
}
if (getOutputWrapper() != null) {
log.debug(getLogPrefix() + "configuring OutputWrapper");
PipeForward pf = new PipeForward();
pf.setName(PipeForward.SUCCESS_FORWARD_NAME);
getOutputWrapper().registerForward(pf);
getOutputWrapper().setName(OUTPUT_WRAPPER_NAME);
if (getOutputWrapper() instanceof EsbSoapWrapperPipe) {
EsbSoapWrapperPipe eswPipe = (EsbSoapWrapperPipe) getOutputWrapper();
for (Receiver<?> receiver : adapter.getReceivers()) {
IListener<?> listener = receiver.getListener();
try {
if (eswPipe.retrievePhysicalDestinationFromListener(listener)) {
break;
}
} catch (JmsException e) {
throw new ConfigurationException(e);
}
}
}
configure(getOutputWrapper());
}
requestSizeStats = new SizeStatisticsKeeper("- pipeline in");
for (IPipe p : pipes) {
if (p.consumesSessionVariable("originalMessage")) {
inputMessageConsumedMultipleTimes = true;
break;
}
}
super.configure();
log.debug(getLogPrefix() + "successfully configured");
configurationSucceeded = true;
}
Aggregations