/** * Processes the given Processing through the specified chain. Note that if one * {@link com.yahoo.docproc.DocumentProcessor DocumentProcessor} in the * chain returns a {@link com.yahoo.docproc.DocumentProcessor.LaterProgress DocumentProcessor.LaterProgress}, * it will be returned by this method. This method will hence return whenever a document processor returns any * {@link com.yahoo.docproc.DocumentProcessor.Progress DocumentProcessor.Progress}, or * throws an exception. * * @param chain the specification of the chain to execute * @param processing the Processing to process * @return any Progress * @throws RuntimeException if one of the document processors in the chain throws */ public DocumentProcessor.Progress processOnce(ComponentSpecification chain, com.yahoo.docproc.Processing processing) { DocprocExecutor executor = getExecutor(chain); processing.setDocprocServiceRegistry(handler.getDocprocServiceRegistry()); return executor.process(processing); }
/** * Processes the given Processing through the specified chain. Note that if one * {@link com.yahoo.docproc.DocumentProcessor DocumentProcessor} in the * chain returns a {@link com.yahoo.docproc.DocumentProcessor.LaterProgress DocumentProcessor.LaterProgress}, * the calling thread will sleep for the duration * specified in {@link com.yahoo.docproc.DocumentProcessor.LaterProgress#getDelay() DocumentProcessor.LaterProgress#getDelay()}, * and then run again. This method will hence return when a document processor returns * {@link com.yahoo.docproc.DocumentProcessor.Progress#DONE DocumentProcessor.Progress#DONE} or * {@link com.yahoo.docproc.DocumentProcessor.Progress#FAILED DocumentProcessor.Progress#FAILED}, throws an exception, * or if the calling thread is interrupted. This method will never return a * {@link com.yahoo.docproc.DocumentProcessor.LaterProgress DocumentProcessor.LaterProgress}. * * @param chain the specification of the chain to execute * @param processing the Processing to process * @return Progress.DONE or Progress.FAILED * @throws RuntimeException if one of the document processors in the chain throws, or if the calling thread is interrupted */ public DocumentProcessor.Progress process(ComponentSpecification chain, com.yahoo.docproc.Processing processing) { DocprocExecutor executor = getExecutor(chain); processing.setDocprocServiceRegistry(handler.getDocprocServiceRegistry()); return executor.processUntilDone(processing); }
private Processing createProcessing(DocumentOperation documentOperation, Message message) { Processing processing = new Processing(); processing.addDocumentOperation(documentOperation); processing.setServiceName(serviceName); processing.setDocprocServiceRegistry(docprocServiceComponentRegistry); processing.setVariable("route", message.getRoute()); processing.setVariable("timeout", message.getTimeRemaining()); return processing; } }