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