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     * Tracing pattern to match which node EIPs to trace.
055     * For example to match all To EIP nodes, use to*.
056     * The pattern matches by node and route id's
057     * Multiple patterns can be separated by comma.
058     */
059    String getTracingPattern();
060
061    /**
062     * Tracing pattern to match which node EIPs to trace.
063     * For example to match all To EIP nodes, use to*.
064     * The pattern matches by node and route id's
065     * Multiple patterns can be separated by comma.
066     */
067    void setTracingPattern(String tracePattern);
068
069    /**
070     * Sets whether backlog tracing is enabled or not (default is disabled).
071     *
072     * @param backlogTrace whether to enable backlog tracing.
073     * @see #setTracing(Boolean)
074     */
075    void setBacklogTracing(Boolean backlogTrace);
076
077    /**
078     * Returns whether backlog tracing enabled
079     *
080     * @return <tt>true</tt> if backlog tracing is enabled
081     */
082    Boolean isBacklogTracing();
083
084    /**
085     * Sets whether debugging is enabled or not (default is enabled).
086     *
087     * @param debugging whether to enable debugging.
088     */
089    void setDebugging(Boolean debugging);
090
091    /**
092     * Returns whether debugging enabled
093     *
094     * @return <tt>true</tt> if tracing is enabled
095     */
096    Boolean isDebugging();
097
098    /**
099     * Sets whether message history is enabled or not (default is enabled).
100     *
101     * @param messageHistory whether message history is enabled
102     */
103    void setMessageHistory(Boolean messageHistory);
104
105    /**
106     * Returns whether message history is enabled
107     *
108     * @return <tt>true</tt> if message history is enabled
109     */
110    Boolean isMessageHistory();
111
112    /**
113     * Sets whether security mask for Logging is enabled or not (default is disabled).
114     * 
115     * @param logMask <tt>true</tt> if mask is enabled
116     */
117    void setLogMask(Boolean logMask);
118
119    /**
120     * Gets whether security mask for Logging is enabled or not.
121     * 
122     * @return <tt>true</tt> if mask is enabled
123     */
124    Boolean isLogMask();
125
126    /**
127     * Sets whether to log exhausted message body with message history.
128     *
129     * @param logExhaustedMessageBody whether message body should be logged
130     */
131    void setLogExhaustedMessageBody(Boolean logExhaustedMessageBody);
132
133    /**
134     * Returns whether to log exhausted message body with message history.
135     * 
136     * @return <tt>true</tt> if logging of message body is enabled
137     */
138    Boolean isLogExhaustedMessageBody();
139
140    /**
141     * Sets a delay value in millis that a message is delayed at every step it takes in the route path,
142     * slowing the process down to better observe what is occurring
143     * <p/>
144     * Is disabled by default
145     *
146     * @param delay delay in millis
147     */
148    void setDelayer(Long delay);
149
150    /**
151     * Gets the delay value
152     *
153     * @return delay in millis, or <tt>null</tt> if disabled
154     */
155    Long getDelayer();
156
157    /**
158     * Sets whether the object should automatically start when Camel starts.
159     * <p/>
160     * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
161     * <br/>
162     * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence
163     * and <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using
164     * the {@link org.apache.camel.CamelContext#start()} method, to start the context, and then
165     * you would need to start the routes manually using {@link org.apache.camel.spi.RouteController#startRoute(String)}.
166     * <p/>
167     * Default is <tt>true</tt> to always start up.
168     *
169     * @param autoStartup whether to start up automatically.
170     */
171    void setAutoStartup(Boolean autoStartup);
172
173    /**
174     * Gets whether the object should automatically start when Camel starts.
175     * <p/>
176     * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
177     * <br/>
178     * Default is <tt>true</tt> to always start up.
179     *
180     * @return <tt>true</tt> if object should automatically start
181     */
182    Boolean isAutoStartup();
183
184    /**
185     * Sets the ShutdownRoute option for routes.
186     *
187     * @param shutdownRoute the option to use.
188     */
189    void setShutdownRoute(ShutdownRoute shutdownRoute);
190
191    /**
192     * Gets the option to use when shutting down the route.
193     *
194     * @return the option
195     */
196    ShutdownRoute getShutdownRoute();
197
198    /**
199     * Sets the ShutdownRunningTask option to use when shutting down a route.
200     *
201     * @param shutdownRunningTask the option to use.
202     */
203    void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask);
204
205    /**
206     * Gets the ShutdownRunningTask option in use when shutting down a route.
207     *
208     * @return the option
209     */
210    ShutdownRunningTask getShutdownRunningTask();
211
212    /**
213     * Sets whether to allow access to the original message from Camel's error handler,
214     * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
215     * <p/>
216     * Turning this off can optimize performance, as defensive copy of the original message is not needed.
217     *
218     * @param allowUseOriginalMessage the option to use.
219     */
220    void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage);
221
222    /**
223     * Gets whether access to the original message from Camel's error handler,
224     * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()} is allowed.
225     *
226     * @return the option
227     */
228    Boolean isAllowUseOriginalMessage();
229
230}