001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel; 018 019 import java.util.List; 020 021 import org.apache.camel.spi.InterceptStrategy; 022 import org.apache.camel.spi.RouteContext; 023 024 /** 025 * Channel acts as a channel between {@link Processor}s in the route graph. 026 * <p/> 027 * The channel is responsible for routing the {@link Exchange} to the next {@link Processor} in the route graph. 028 * 029 * @version 030 */ 031 public interface Channel extends AsyncProcessor, Navigate<Processor> { 032 033 /** 034 * Sets the processor that the channel should route the {@link Exchange} to. 035 * 036 * @param next the next processor 037 */ 038 void setNextProcessor(Processor next); 039 040 /** 041 * Sets the {@link org.apache.camel.processor.ErrorHandler} this Channel uses. 042 * 043 * @param errorHandler the error handler 044 */ 045 void setErrorHandler(Processor errorHandler); 046 047 /** 048 * Gets the {@link org.apache.camel.processor.ErrorHandler} this Channel uses. 049 * 050 * @return the error handler, or <tt>null</tt> if no error handler is used. 051 */ 052 Processor getErrorHandler(); 053 054 /** 055 * Adds a {@link org.apache.camel.spi.InterceptStrategy} to apply each {@link Exchange} before 056 * its routed to the next {@link Processor}. 057 * 058 * @param strategy the intercept strategy 059 */ 060 void addInterceptStrategy(InterceptStrategy strategy); 061 062 /** 063 * Adds a list of {@link org.apache.camel.spi.InterceptStrategy} to apply each {@link Exchange} before 064 * its routed to the next {@link Processor}. 065 * 066 * @param strategy list of strategies 067 */ 068 void addInterceptStrategies(List<InterceptStrategy> strategy); 069 070 /** 071 * Gets the list of {@link org.apache.camel.spi.InterceptStrategy} registered to this Channel. 072 * 073 * @return list of strategies, returns an empty list if no strategies is registered. 074 */ 075 List<InterceptStrategy> getInterceptStrategies(); 076 077 /** 078 * Gets the wrapped output that at runtime should be delegated to. 079 * 080 * @return the output to route the {@link Exchange} to 081 */ 082 Processor getOutput(); 083 084 /** 085 * Sets the wrapped output that at runtime should be delegated to. 086 * 087 * @param output the output to route the {@link Exchange} to 088 */ 089 void setOutput(Processor output); 090 091 /** 092 * Gets the next {@link Processor} to route to (not wrapped) 093 * 094 * @return the next processor 095 */ 096 Processor getNextProcessor(); 097 098 /** 099 * Gets the {@link RouteContext} 100 * 101 * @return the route context 102 */ 103 RouteContext getRouteContext(); 104 }