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 * 023 * @version 024 */ 025public 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 then 108 * you would need to start the routes manually using {@link CamelContext#startRoute(String)}. 109 * <p/> 110 * Default is <tt>true</tt> to always start up. 111 * 112 * @param autoStartup whether to start up automatically. 113 */ 114 void setAutoStartup(Boolean autoStartup); 115 116 /** 117 * Gets whether the object should automatically start when Camel starts. 118 * <p/> 119 * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started. 120 * <br/> 121 * Default is <tt>true</tt> to always start up. 122 * 123 * @return <tt>true</tt> if object should automatically start 124 */ 125 Boolean isAutoStartup(); 126 127 /** 128 * Sets the ShutdownRoute option for routes. 129 * 130 * @param shutdownRoute the option to use. 131 */ 132 void setShutdownRoute(ShutdownRoute shutdownRoute); 133 134 /** 135 * Gets the option to use when shutting down the route. 136 * 137 * @return the option 138 */ 139 ShutdownRoute getShutdownRoute(); 140 141 /** 142 * Sets the ShutdownRunningTask option to use when shutting down a route. 143 * 144 * @param shutdownRunningTask the option to use. 145 */ 146 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask); 147 148 /** 149 * Gets the ShutdownRunningTask option in use when shutting down a route. 150 * 151 * @return the option 152 */ 153 ShutdownRunningTask getShutdownRunningTask(); 154 155 /** 156 * Sets whether to allow access to the original message from Camel's error handler, 157 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}. 158 * <p/> 159 * Turning this off can optimize performance, as defensive copy of the original message is not needed. 160 * 161 * @param allowUseOriginalMessage the option to use. 162 */ 163 void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage); 164 165 /** 166 * Sets whether to allow access to the original message from Camel's error handler, 167 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}. 168 * <p/> 169 * Turning this off can optimize performance, as defensive copy of the original message is not needed. 170 * 171 * @return the option 172 */ 173 Boolean isAllowUseOriginalMessage(); 174 175}