001/* 002 * (C) Copyright 2006-2016 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * tiry 018 */ 019package org.nuxeo.ecm.core.event.pipe.dispatch; 020 021import org.nuxeo.ecm.core.event.EventBundle; 022import org.nuxeo.ecm.core.event.pipe.EventBundlePipe; 023import org.nuxeo.ecm.core.event.pipe.EventPipeDescriptor; 024 025import java.util.List; 026import java.util.Map; 027 028/** 029 * Interface for dispatching {@link EventBundle} between different {@link EventBundlePipe} 030 * 031 * @since 8.4 032 */ 033public interface EventBundleDispatcher { 034 035 /** 036 * Initialize the dispatcher 037 * 038 * @param pipeDescriptors descriptors of the underlying {@link EventBundlePipe}s 039 */ 040 void init(List<EventPipeDescriptor> pipeDescriptors, Map<String, String> parameters); 041 042 /** 043 * Forward an {@link EventBundle} to the underlying {@link EventBundlePipe}s 044 */ 045 void sendEventBundle(EventBundle events); 046 047 /** 048 * Wait until the end of processing 049 */ 050 boolean waitForCompletion(long timeoutMillis) throws InterruptedException; 051 052 /** 053 * Shutdown callback 054 */ 055 void shutdown() throws InterruptedException; 056 057}