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    @Deprecated(since = "4.19.0")
167    boolean isUseMDCLogging();
168
169    @ManagedAttribute(description = "Whether Message DataType is enabled")
170    boolean isUseDataType();
171
172    @ManagedOperation(description = "Start Camel")
173    void start() throws Exception;
174
175    @ManagedOperation(description = "Stop Camel (shutdown)")
176    void stop() throws Exception;
177
178    @ManagedOperation(description = "Restart Camel (stop and then start)")
179    void restart() throws Exception;
180
181    @ManagedOperation(description = "Suspend Camel")
182    void suspend() throws Exception;
183
184    @ManagedOperation(description = "Resume Camel")
185    void resume() throws Exception;
186
187    @ManagedOperation(description = "Starts all the routes which currently is not started")
188    void startAllRoutes() throws Exception;
189
190    @ManagedOperation(description = "Whether its possible to send to the endpoint (eg the endpoint has a producer)")
191    boolean canSendToEndpoint(String endpointUri);
192
193    @ManagedOperation(description = "Send body (in only)")
194    void sendBody(String endpointUri, Object body) throws Exception;
195
196    @ManagedOperation(description = "Send body (String type) (in only)")
197    void sendStringBody(String endpointUri, String body) throws Exception;
198
199    @ManagedOperation(description = "Send body and headers (in only)")
200    void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception;
201
202    @ManagedOperation(description = "Request body (in out)")
203    Object requestBody(String endpointUri, Object body) throws Exception;
204
205    @ManagedOperation(description = "Request body (String type) (in out)")
206    Object requestStringBody(String endpointUri, String body) throws Exception;
207
208    @ManagedOperation(description = "Request body and headers (in out)")
209    Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception;
210
211    @ManagedOperation(description = "Dumps the rests as XML")
212    String dumpRestsAsXml() throws Exception;
213
214    @ManagedOperation(description = "Dumps the rests as XML")
215    String dumpRestsAsXml(boolean resolvePlaceholders) throws Exception;
216
217    @ManagedOperation(description = "Dumps the routes as XML")
218    String dumpRoutesAsXml() throws Exception;
219
220    @ManagedOperation(description = "Dumps the routes as XML")
221    String dumpRoutesAsXml(boolean resolvePlaceholders) throws Exception;
222
223    @ManagedOperation(description = "Dumps the routes as XML")
224    String dumpRoutesAsXml(boolean resolvePlaceholders, boolean generatedIds) throws Exception;
225
226    @ManagedOperation(description = "Dumps the routes as XML")
227    String dumpRoutesAsXml(boolean resolvePlaceholders, boolean generatedIds, boolean sourceLocation) throws Exception;
228
229    @ManagedOperation(description = "Dumps the CamelContext and routes stats as XML")
230    String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
231
232    @ManagedOperation(description = "Dumps the CamelContext and routes stats as JSon")
233    String dumpRouteStatsAsJSon(boolean fullStats, boolean includeProcessors) throws Exception;
234
235    @ManagedOperation(description = "Dumps the CamelContext and routes and steps stats as XML")
236    String dumpStepStatsAsXml(boolean fullStats) throws Exception;
237
238    @ManagedOperation(description = "Dumps the routes coverage as XML")
239    String dumpRoutesCoverageAsXml() throws Exception;
240
241    @ManagedOperation(description = "Dumps the route templates as XML")
242    String dumpRouteTemplatesAsXml() throws Exception;
243
244    @ManagedOperation(description = "Dumps the routes as YAML")
245    String dumpRoutesAsYaml() throws Exception;
246
247    @ManagedOperation(description = "Dumps the routes as YAML")
248    String dumpRoutesAsYaml(boolean resolvePlaceholders) throws Exception;
249
250    @ManagedOperation(description = "Dumps the routes as YAML")
251    String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters) throws Exception;
252
253    @ManagedOperation(description = "Dumps the routes as YAML")
254    String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters, boolean generatedIds) throws Exception;
255
256    @ManagedOperation(description = "Dumps the routes as YAML")
257    String dumpRoutesAsYaml(boolean resolvePlaceholders, boolean uriAsParameters, boolean generatedIds, boolean sourceLocation)
258            throws Exception;
259
260    /**
261     * Creates the endpoint by the given uri
262     *
263     * @param  uri       uri of endpoint to create
264     * @return           <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed
265     * @throws Exception is thrown if error occurred
266     */
267    @ManagedOperation(description = "Creates the endpoint by the given URI")
268    boolean createEndpoint(String uri) throws Exception;
269
270    /**
271     * Removes the endpoint by the given pattern
272     *
273     * @param  pattern   the pattern
274     * @return           number of endpoints removed
275     * @throws Exception is thrown if error occurred
276     * @see              org.apache.camel.CamelContext#removeEndpoints(String)
277     */
278    @ManagedOperation(description = "Removes endpoints by the given pattern")
279    int removeEndpoints(String pattern) throws Exception;
280
281    /**
282     * Resets all the performance counters.
283     *
284     * @param  includeRoutes whether to reset all routes as well.
285     * @throws Exception     is thrown if error occurred
286     */
287    @ManagedOperation(description = "Reset counters")
288    void reset(boolean includeRoutes) throws Exception;
289
290    /**
291     * The names of the components currently registered
292     */
293    @ManagedOperation(description = "The names of the components currently registered")
294    Set<String> componentNames() throws Exception;
295
296    /**
297     * The names of the languages currently registered
298     */
299    @ManagedOperation(description = "The names of the languages currently registered")
300    Set<String> languageNames() throws Exception;
301
302    /**
303     * The names of the data formats currently registered
304     */
305    @ManagedOperation(description = "The names of the data formats currently registered")
306    Set<String> dataFormatNames() throws Exception;
307
308    @ManagedOperation(description = "Current ids of all the routes")
309    Set<String> routeIds();
310
311    @ManagedOperation(description = "Current route group names of all the routes (is empty if there are no route groups assigned)")
312    Set<String> routeGroups();
313
314}