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 to log exhausted message body with message history. 071 * 072 * @param logExhaustedMessageBody whether message body should be logged 073 */ 074 void setLogExhaustedMessageBody(Boolean logExhaustedMessageBody); 075 076 /** 077 * Returns whether to log exhausted message body with message history. 078 * 079 * @return <tt>true</tt> if logging of message body is enabled 080 */ 081 Boolean isLogExhaustedMessageBody(); 082 083 /** 084 * Sets whether fault handling is enabled or not (default is disabled). 085 * 086 * @param handleFault whether to enable fault handling. 087 */ 088 void setHandleFault(Boolean handleFault); 089 090 /** 091 * Returns whether fault handling enabled 092 * 093 * @return <tt>true</tt> if fault handling is enabled 094 */ 095 Boolean isHandleFault(); 096 097 /** 098 * Sets a delay value in millis that a message is delayed at every step it takes in the route path, 099 * slowing the process down to better observe what is occurring 100 * <p/> 101 * Is disabled by default 102 * 103 * @param delay delay in millis 104 */ 105 void setDelayer(Long delay); 106 107 /** 108 * Gets the delay value 109 * 110 * @return delay in millis, or <tt>null</tt> if disabled 111 */ 112 Long getDelayer(); 113 114 /** 115 * Sets whether the object should automatically start when Camel starts. 116 * <p/> 117 * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started. 118 * <br/> 119 * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence 120 * and <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using 121 * the {@link org.apache.camel.CamelContext#start()} method, to start the context, and then 122 * you would need to start the routes manually using {@link CamelContext#startRoute(String)}. 123 * <p/> 124 * Default is <tt>true</tt> to always start up. 125 * 126 * @param autoStartup whether to start up automatically. 127 */ 128 void setAutoStartup(Boolean autoStartup); 129 130 /** 131 * Gets whether the object should automatically start when Camel starts. 132 * <p/> 133 * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started. 134 * <br/> 135 * Default is <tt>true</tt> to always start up. 136 * 137 * @return <tt>true</tt> if object should automatically start 138 */ 139 Boolean isAutoStartup(); 140 141 /** 142 * Sets the ShutdownRoute option for routes. 143 * 144 * @param shutdownRoute the option to use. 145 */ 146 void setShutdownRoute(ShutdownRoute shutdownRoute); 147 148 /** 149 * Gets the option to use when shutting down the route. 150 * 151 * @return the option 152 */ 153 ShutdownRoute getShutdownRoute(); 154 155 /** 156 * Sets the ShutdownRunningTask option to use when shutting down a route. 157 * 158 * @param shutdownRunningTask the option to use. 159 */ 160 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask); 161 162 /** 163 * Gets the ShutdownRunningTask option in use when shutting down a route. 164 * 165 * @return the option 166 */ 167 ShutdownRunningTask getShutdownRunningTask(); 168 169 /** 170 * Sets whether to allow access to the original message from Camel's error handler, 171 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}. 172 * <p/> 173 * Turning this off can optimize performance, as defensive copy of the original message is not needed. 174 * 175 * @param allowUseOriginalMessage the option to use. 176 */ 177 void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage); 178 179 /** 180 * Sets whether to allow access to the original message from Camel's error handler, 181 * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}. 182 * <p/> 183 * Turning this off can optimize performance, as defensive copy of the original message is not needed. 184 * 185 * @return the option 186 */ 187 Boolean isAllowUseOriginalMessage(); 188 189}