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 import java.util.Map;
021
022 import org.apache.camel.spi.RouteContext;
023
024 /**
025 * A <a href="http://camel.apache.org/routes.html">Route</a>
026 * defines the processing used on an inbound message exchange
027 * from a specific {@link org.apache.camel.Endpoint} within a {@link org.apache.camel.CamelContext}
028 */
029 public interface Route {
030
031 String ID_PROPERTY = "id";
032 String PARENT_PROPERTY = "parent";
033 String GROUP_PROPERTY = "group";
034
035 /**
036 * Gets the route id
037 *
038 * @return the route id
039 */
040 String getId();
041
042 /**
043 * Gets the inbound endpoint
044 */
045 Endpoint getEndpoint();
046
047 /**
048 * Gets the inbound {@link Consumer}
049 */
050 Consumer getConsumer();
051
052 /**
053 * Whether or not the route supports suspension
054 */
055 boolean supportsSuspension();
056
057 /**
058 * This property map is used to associate information about the route.
059 *
060 * @return properties
061 */
062 Map<String, Object> getProperties();
063
064 /**
065 * Gets the route context
066 *
067 * @return the route context
068 */
069 RouteContext getRouteContext();
070
071 /**
072 * A strategy callback allowing special initialization when services is starting.
073 *
074 * @param services the service
075 * @throws Exception is thrown in case of error
076 */
077 void onStartingServices(List<Service> services) throws Exception;
078
079 /**
080 * Returns the services for this particular route
081 */
082 List<Service> getServices();
083
084 /**
085 * Adds a service to this route
086 *
087 * @param service the service
088 */
089 void addService(Service service);
090
091 /**
092 * Returns a navigator to navigate this route by navigating all the {@link Processor}s.
093 *
094 * @return a navigator for {@link Processor}.
095 */
096 Navigate<Processor> navigate();
097
098 }