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.api.management.mbean; 018 019import java.util.Map; 020import java.util.Set; 021import java.util.concurrent.TimeUnit; 022 023import org.apache.camel.api.management.ManagedAttribute; 024import org.apache.camel.api.management.ManagedOperation; 025 026public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean { 027 028 @ManagedAttribute(description = "Camel ID") 029 String getCamelId(); 030 031 @ManagedAttribute(description = "Camel Description") 032 String getCamelDescription(); 033 034 @ManagedAttribute(description = "Camel ManagementName") 035 String getManagementName(); 036 037 @ManagedAttribute(description = "Camel Version") 038 String getCamelVersion(); 039 040 @ManagedAttribute(description = "Camel Profile") 041 String getProfile(); 042 043 @ManagedAttribute(description = "Camel Auto Startup") 044 Boolean getAutoStartup(); 045 046 @ManagedAttribute(description = "Camel Auto Startup Exclude Pattern") 047 String getAutoStartupExcludePattern(); 048 049 @ManagedAttribute(description = "Camel State") 050 String getState(); 051 052 @ManagedAttribute(description = "Uptime [human readable text]") 053 String getUptime(); 054 055 @ManagedAttribute(description = "Uptime [milliseconds]") 056 long getUptimeMillis(); 057 058 @ManagedAttribute(description = "Camel Management StatisticsLevel") 059 String getManagementStatisticsLevel(); 060 061 @ManagedAttribute(description = "Camel Global Options") 062 Map<String, String> getGlobalOptions(); 063 064 @ManagedAttribute(description = "ClassResolver class name") 065 String getClassResolver(); 066 067 @ManagedAttribute(description = "PackageScanClassResolver class name") 068 String getPackageScanClassResolver(); 069 070 @ManagedAttribute(description = "ApplicationContext class name") 071 String getApplicationContextClassName(); 072 073 @ManagedAttribute(description = "HeadersMapFactory class name") 074 String getHeadersMapFactoryClassName(); 075 076 @ManagedAttribute(description = "Additional sensitive keywords (such as passwords) that should be masked when logging") 077 String getAdditionalSensitiveKeywords(); 078 079 /** 080 * Gets the value of a CamelContext global option 081 * 082 * @param key the global option key 083 * @return the global option value 084 * @throws Exception when an error occurred 085 */ 086 @ManagedOperation(description = "Gets the value of a Camel global option") 087 String getGlobalOption(String key) throws Exception; 088 089 /** 090 * Sets the value of a CamelContext property name 091 * 092 * @param key the global option key 093 * @param value the global option value 094 * @throws Exception when an error occurred 095 */ 096 @ManagedOperation(description = "Sets the value of a Camel global option") 097 void setGlobalOption(String key, String value) throws Exception; 098 099 @ManagedAttribute(description = "Tracing") 100 Boolean getTracing(); 101 102 @ManagedAttribute(description = "Tracing") 103 void setTracing(Boolean tracing); 104 105 @ManagedAttribute(description = "Total number of routes") 106 Integer getTotalRoutes(); 107 108 @ManagedAttribute(description = "Current number of started routes") 109 Integer getStartedRoutes(); 110 111 @ManagedAttribute(description = "Shutdown timeout") 112 void setTimeout(long timeout); 113 114 @ManagedAttribute(description = "Shutdown timeout") 115 long getTimeout(); 116 117 @ManagedAttribute(description = "Shutdown timeout time unit") 118 void setTimeUnit(TimeUnit timeUnit); 119 120 @ManagedAttribute(description = "Shutdown timeout time unit") 121 TimeUnit getTimeUnit(); 122 123 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 124 void setShutdownNowOnTimeout(boolean shutdownNowOnTimeout); 125 126 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 127 boolean isShutdownNowOnTimeout(); 128 129 @ManagedAttribute(description = "Average load (inflight messages, not cpu) over the last minute") 130 String getLoad01(); 131 132 @ManagedAttribute(description = "Average load (inflight messages, not cpu) over the last five minutes") 133 String getLoad05(); 134 135 @ManagedAttribute(description = "Average load (inflight messages, not cpu) over the last fifteen minutes") 136 String getLoad15(); 137 138 @ManagedAttribute(description = "Throughput message/second") 139 String getThroughput(); 140 141 @ManagedAttribute(description = "Total number of exchanges processed from remote endpoints only") 142 long getRemoteExchangesTotal(); 143 144 @ManagedAttribute(description = "Completed (success) number of exchanges processed from remote endpoints only") 145 long getRemoteExchangesCompleted(); 146 147 @ManagedAttribute(description = "Failed number of exchanges processed from remote endpoints only") 148 long getRemoteExchangesFailed(); 149 150 @ManagedAttribute(description = "Total number of exchanges inflight from remote endpoints only") 151 long getRemoteExchangesInflight(); 152 153 @ManagedAttribute(description = "Whether breadcrumbs is in use") 154 boolean isUseBreadcrumb(); 155 156 @ManagedAttribute(description = "Whether allowing access to the original message during routing") 157 boolean isAllowUseOriginalMessage(); 158 159 @ManagedAttribute(description = "Whether message history is enabled") 160 boolean isMessageHistory(); 161 162 @ManagedAttribute(description = "Whether security mask for Logging is enabled") 163 boolean isLogMask(); 164 165 @ManagedAttribute(description = "Whether MDC logging is supported") 166 boolean isUseMDCLogging(); 167 168 @ManagedAttribute(description = "Whether Message DataType is enabled") 169 boolean isUseDataType(); 170 171 @ManagedOperation(description = "Start Camel") 172 void start() throws Exception; 173 174 @ManagedOperation(description = "Stop Camel (shutdown)") 175 void stop() throws Exception; 176 177 @ManagedOperation(description = "Restart Camel (stop and then start)") 178 void restart() throws Exception; 179 180 @ManagedOperation(description = "Suspend Camel") 181 void suspend() throws Exception; 182 183 @ManagedOperation(description = "Resume Camel") 184 void resume() throws Exception; 185 186 @ManagedOperation(description = "Starts all the routes which currently is not started") 187 void startAllRoutes() throws Exception; 188 189 @ManagedOperation(description = "Whether its possible to send to the endpoint (eg the endpoint has a producer)") 190 boolean canSendToEndpoint(String endpointUri); 191 192 @ManagedOperation(description = "Send body (in only)") 193 void sendBody(String endpointUri, Object body) throws Exception; 194 195 @ManagedOperation(description = "Send body (String type) (in only)") 196 void sendStringBody(String endpointUri, String body) throws Exception; 197 198 @ManagedOperation(description = "Send body and headers (in only)") 199 void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 200 201 @ManagedOperation(description = "Request body (in out)") 202 Object requestBody(String endpointUri, Object body) throws Exception; 203 204 @ManagedOperation(description = "Request body (String type) (in out)") 205 Object requestStringBody(String endpointUri, String body) throws Exception; 206 207 @ManagedOperation(description = "Request body and headers (in out)") 208 Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 209 210 @ManagedOperation(description = "Dumps the rests as XML") 211 String dumpRestsAsXml() throws Exception; 212 213 @ManagedOperation(description = "Dumps the rests as XML") 214 String dumpRestsAsXml(boolean resolvePlaceholders) throws Exception; 215 216 @ManagedOperation(description = "Dumps the routes as XML") 217 String dumpRoutesAsXml() throws Exception; 218 219 @ManagedOperation(description = "Dumps the routes as XML") 220 String dumpRoutesAsXml(boolean resolvePlaceholders) throws Exception; 221 222 @ManagedOperation(description = "Dumps the routes as XML") 223 String dumpRoutesAsXml(boolean resolvePlaceholders, boolean generatedIds) throws Exception; 224 225 @ManagedOperation(description = "Dumps the routes as XML") 226 String dumpRoutesAsXml(boolean resolvePlaceholders, boolean generatedIds, boolean sourceLocation) throws Exception; 227 228 @ManagedOperation(description = "Dumps the CamelContext and routes stats as XML") 229 String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception; 230 231 @ManagedOperation(description = "Dumps the CamelContext and routes stats as JSon") 232 String dumpRouteStatsAsJSon(boolean fullStats, boolean includeProcessors) throws Exception; 233 234 @ManagedOperation(description = "Dumps the CamelContext and routes and steps stats as XML") 235 String dumpStepStatsAsXml(boolean fullStats) throws Exception; 236 237 @ManagedOperation(description = "Dumps the routes coverage as XML") 238 String dumpRoutesCoverageAsXml() throws Exception; 239 240 @ManagedOperation(description = "Dumps the route templates as XML") 241 String dumpRouteTemplatesAsXml() throws Exception; 242 243 @ManagedOperation(description = "Dumps the routes as YAML") 244 String dumpRoutesAsYaml() throws Exception; 245 246 @ManagedOperation(description = "Dumps the routes as YAML") 247 String dumpRoutesAsYaml(boolean resolvePlaceholders) throws Exception; 248 249 @ManagedOperation(description = "Dumps the routes as YAML") 250 String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters) throws Exception; 251 252 @ManagedOperation(description = "Dumps the routes as YAML") 253 String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters, boolean generatedIds) throws Exception; 254 255 @ManagedOperation(description = "Dumps the routes as YAML") 256 String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters, boolean generatedIds, boolean sourceLocation) 257 throws Exception; 258 259 /** 260 * Creates the endpoint by the given uri 261 * 262 * @param uri uri of endpoint to create 263 * @return <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed 264 * @throws Exception is thrown if error occurred 265 */ 266 @ManagedOperation(description = "Creates the endpoint by the given URI") 267 boolean createEndpoint(String uri) throws Exception; 268 269 /** 270 * Removes the endpoint by the given pattern 271 * 272 * @param pattern the pattern 273 * @return number of endpoints removed 274 * @throws Exception is thrown if error occurred 275 * @see org.apache.camel.CamelContext#removeEndpoints(String) 276 */ 277 @ManagedOperation(description = "Removes endpoints by the given pattern") 278 int removeEndpoints(String pattern) throws Exception; 279 280 /** 281 * Resets all the performance counters. 282 * 283 * @param includeRoutes whether to reset all routes as well. 284 * @throws Exception is thrown if error occurred 285 */ 286 @ManagedOperation(description = "Reset counters") 287 void reset(boolean includeRoutes) throws Exception; 288 289 /** 290 * The names of the components currently registered 291 */ 292 @ManagedOperation(description = "The names of the components currently registered") 293 Set<String> componentNames() throws Exception; 294 295 /** 296 * The names of the languages currently registered 297 */ 298 @ManagedOperation(description = "The names of the languages currently registered") 299 Set<String> languageNames() throws Exception; 300 301 /** 302 * The names of the data formats currently registered 303 */ 304 @ManagedOperation(description = "The names of the data formats currently registered") 305 Set<String> dataFormatNames() throws Exception; 306 307 @ManagedOperation(description = "Current ids of all the routes") 308 Set<String> routeIds(); 309 310 @ManagedOperation(description = "Current route group names of all the routes (is empty if there are no route groups assigned)") 311 Set<String> routeGroups(); 312 313}