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