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 /**
020 * Various runtime configuration options used by {@link org.apache.camel.CamelContext} and {@link org.apache.camel.spi.RouteContext}
021 * for cross cutting functions such as tracing, delayer, stream cache and the like.
022 *
023 * @version
024 */
025 public interface RuntimeConfiguration {
026
027 /**
028 * Sets whether stream caching is enabled or not (default is disabled).
029 *
030 * @param cache whether stream caching is enabled or not
031 */
032 void setStreamCaching(Boolean cache);
033
034 /**
035 * Returns whether stream cache is enabled
036 *
037 * @return <tt>true</tt> if stream cache is enabled
038 */
039 Boolean isStreamCaching();
040
041 /**
042 * Sets whether tracing is enabled or not (default is disabled).
043 *
044 * @param tracing whether to enable tracing.
045 */
046 void setTracing(Boolean tracing);
047
048 /**
049 * Returns whether tracing enabled
050 *
051 * @return <tt>true</tt> if tracing is enabled
052 */
053 Boolean isTracing();
054
055 /**
056 * Sets whether message history is enabled or not (default is enabled).
057 *
058 * @param messageHistory whether message history is enabled
059 */
060 void setMessageHistory(Boolean messageHistory);
061
062 /**
063 * Returns whether message history is enabled
064 *
065 * @return <tt>true</tt> if message history is enabled
066 */
067 Boolean isMessageHistory();
068
069 /**
070 * Sets whether fault handling is enabled or not (default is disabled).
071 *
072 * @param handleFault whether to enable fault handling.
073 */
074 void setHandleFault(Boolean handleFault);
075
076 /**
077 * Returns whether fault handling enabled
078 *
079 * @return <tt>true</tt> if fault handling is enabled
080 */
081 Boolean isHandleFault();
082
083 /**
084 * Sets a delay value in millis that a message is delayed at every step it takes in the route path,
085 * slowing the process down to better observe what is occurring
086 * <p/>
087 * Is disabled by default
088 *
089 * @param delay delay in millis
090 */
091 void setDelayer(Long delay);
092
093 /**
094 * Gets the delay value
095 *
096 * @return delay in millis, or <tt>null</tt> if disabled
097 */
098 Long getDelayer();
099
100 /**
101 * Sets whether the object should automatically start when Camel starts.
102 * <p/>
103 * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
104 * <br/>
105 * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence
106 * and <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using
107 * the {@link org.apache.camel.CamelContext#start()} method, to start the context and the routes.
108 * <p/>
109 * Default is <tt>true</tt> to always start up.
110 *
111 * @param autoStartup whether to start up automatically.
112 */
113 void setAutoStartup(Boolean autoStartup);
114
115 /**
116 * Gets whether the object should automatically start when Camel starts.
117 * <p/>
118 * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
119 * <br/>
120 * Default is <tt>true</tt> to always start up.
121 *
122 * @return <tt>true</tt> if object should automatically start
123 */
124 Boolean isAutoStartup();
125
126 /**
127 * Sets the ShutdownRoute option for routes.
128 *
129 * @param shutdownRoute the option to use.
130 */
131 void setShutdownRoute(ShutdownRoute shutdownRoute);
132
133 /**
134 * Gets the option to use when shutting down the route.
135 *
136 * @return the option
137 */
138 ShutdownRoute getShutdownRoute();
139
140 /**
141 * Sets the ShutdownRunningTask option to use when shutting down a route.
142 *
143 * @param shutdownRunningTask the option to use.
144 */
145 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask);
146
147 /**
148 * Gets the ShutdownRunningTask option in use when shutting down a route.
149 *
150 * @return the option
151 */
152 ShutdownRunningTask getShutdownRunningTask();
153
154 /**
155 * Sets whether to allow access to the original message from Camel's error handler,
156 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
157 * <p/>
158 * Turning this off can optimize performance, as defensive copy of the original message is not needed.
159 *
160 * @param allowUseOriginalMessage the option to use.
161 */
162 void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage);
163
164 /**
165 * Sets whether to allow access to the original message from Camel's error handler,
166 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
167 * <p/>
168 * Turning this off can optimize performance, as defensive copy of the original message is not needed.
169 *
170 * @return the option
171 */
172 Boolean isAllowUseOriginalMessage();
173
174 }