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 019import java.io.IOException; 020import java.io.InputStream; 021import java.util.Collection; 022import java.util.List; 023import java.util.Map; 024import java.util.Properties; 025import java.util.Set; 026import java.util.concurrent.ScheduledExecutorService; 027import java.util.concurrent.TimeUnit; 028 029import org.apache.camel.api.management.mbean.ManagedCamelContextMBean; 030import org.apache.camel.api.management.mbean.ManagedProcessorMBean; 031import org.apache.camel.api.management.mbean.ManagedRouteMBean; 032import org.apache.camel.builder.ErrorHandlerBuilder; 033import org.apache.camel.health.HealthCheckRegistry; 034import org.apache.camel.model.DataFormatDefinition; 035import org.apache.camel.model.HystrixConfigurationDefinition; 036import org.apache.camel.model.ProcessorDefinition; 037import org.apache.camel.model.RouteDefinition; 038import org.apache.camel.model.RoutesDefinition; 039import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition; 040import org.apache.camel.model.rest.RestDefinition; 041import org.apache.camel.model.rest.RestsDefinition; 042import org.apache.camel.model.transformer.TransformerDefinition; 043import org.apache.camel.model.validator.ValidatorDefinition; 044import org.apache.camel.runtimecatalog.RuntimeCamelCatalog; 045import org.apache.camel.spi.AsyncProcessorAwaitManager; 046import org.apache.camel.spi.CamelContextNameStrategy; 047import org.apache.camel.spi.ClassResolver; 048import org.apache.camel.spi.DataFormat; 049import org.apache.camel.spi.DataFormatResolver; 050import org.apache.camel.spi.DataType; 051import org.apache.camel.spi.Debugger; 052import org.apache.camel.spi.EndpointRegistry; 053import org.apache.camel.spi.EndpointStrategy; 054import org.apache.camel.spi.ExecutorServiceManager; 055import org.apache.camel.spi.FactoryFinder; 056import org.apache.camel.spi.FactoryFinderResolver; 057import org.apache.camel.spi.HeadersMapFactory; 058import org.apache.camel.spi.InflightRepository; 059import org.apache.camel.spi.Injector; 060import org.apache.camel.spi.InterceptStrategy; 061import org.apache.camel.spi.Language; 062import org.apache.camel.spi.LifecycleStrategy; 063import org.apache.camel.spi.LogListener; 064import org.apache.camel.spi.ManagementMBeanAssembler; 065import org.apache.camel.spi.ManagementNameStrategy; 066import org.apache.camel.spi.ManagementStrategy; 067import org.apache.camel.spi.MessageHistoryFactory; 068import org.apache.camel.spi.ModelJAXBContextFactory; 069import org.apache.camel.spi.NodeIdFactory; 070import org.apache.camel.spi.PackageScanClassResolver; 071import org.apache.camel.spi.ProcessorFactory; 072import org.apache.camel.spi.Registry; 073import org.apache.camel.spi.ReloadStrategy; 074import org.apache.camel.spi.RestConfiguration; 075import org.apache.camel.spi.RestRegistry; 076import org.apache.camel.spi.RouteController; 077import org.apache.camel.spi.RoutePolicyFactory; 078import org.apache.camel.spi.RouteStartupOrder; 079import org.apache.camel.spi.RuntimeEndpointRegistry; 080import org.apache.camel.spi.ServicePool; 081import org.apache.camel.spi.ShutdownStrategy; 082import org.apache.camel.spi.StreamCachingStrategy; 083import org.apache.camel.spi.Transformer; 084import org.apache.camel.spi.TransformerRegistry; 085import org.apache.camel.spi.TypeConverterRegistry; 086import org.apache.camel.spi.UnitOfWorkFactory; 087import org.apache.camel.spi.UuidGenerator; 088import org.apache.camel.spi.Validator; 089import org.apache.camel.spi.ValidatorRegistry; 090import org.apache.camel.util.LoadPropertiesException; 091import org.apache.camel.util.jsse.SSLContextParameters; 092 093/** 094 * Interface used to represent the CamelContext used to configure routes and the 095 * policies to use during message exchanges between endpoints. 096 * <p/> 097 * The CamelContext offers the following methods to control the lifecycle: 098 * <ul> 099 * <li>{@link #start()} - to start (<b>important:</b> the start method is not blocked, see more details 100 * <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li> 101 * <li>{@link #stop()} - to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)</li> 102 * <li>{@link #suspend()} - to pause routing messages</li> 103 * <li>{@link #resume()} - to resume after a suspend</li> 104 * </ul> 105 * <p/> 106 * <b>Notice:</b> {@link #stop()} and {@link #suspend()} will gracefully stop/suspend routes ensuring any messages 107 * in progress will be given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}. 108 * <p/> 109 * If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster 110 * restart but also allows any internal state to be kept as is. 111 * The stop/start approach will do a <i>cold</i> restart of Camel, where all internal state is reset. 112 * <p/> 113 * End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that 114 * when it's being started again using the start method that Camel will operate consistently. 115 * 116 * @version 117 */ 118public interface CamelContext extends SuspendableService, RuntimeConfiguration { 119 120 /** 121 * Adapts this {@link org.apache.camel.CamelContext} to the specialized type. 122 * <p/> 123 * For example to adapt to {@link org.apache.camel.model.ModelCamelContext}, 124 * or <tt>SpringCamelContext</tt>, or <tt>CdiCamelContext</tt>, etc. 125 * 126 * @param type the type to adapt to 127 * @return this {@link org.apache.camel.CamelContext} adapted to the given type 128 */ 129 <T extends CamelContext> T adapt(Class<T> type); 130 131 /** 132 * If CamelContext during the start procedure was vetoed, and therefore causing Camel to not start. 133 */ 134 boolean isVetoStarted(); 135 136 /** 137 * Starts the {@link CamelContext} (<b>important:</b> the start method is not blocked, see more details 138 * <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>. 139 * <p/> 140 * See more details at the class-level javadoc of this class. 141 * 142 * @throws Exception is thrown if starting failed 143 */ 144 void start() throws Exception; 145 146 /** 147 * Stop and shutdown the {@link CamelContext} (will stop all routes/components/endpoints etc and clear internal state/cache). 148 * <p/> 149 * See more details at the class-level javadoc of this class. 150 * 151 * @throws Exception is thrown if stopping failed 152 */ 153 void stop() throws Exception; 154 155 /** 156 * Gets the name (id) of the this CamelContext. 157 * 158 * @return the name 159 */ 160 String getName(); 161 162 /** 163 * Gets the current name strategy 164 * 165 * @return name strategy 166 */ 167 CamelContextNameStrategy getNameStrategy(); 168 169 /** 170 * Sets a custom name strategy 171 * 172 * @param nameStrategy name strategy 173 */ 174 void setNameStrategy(CamelContextNameStrategy nameStrategy); 175 176 /** 177 * Gets the current management name strategy 178 * 179 * @return management name strategy 180 */ 181 ManagementNameStrategy getManagementNameStrategy(); 182 183 /** 184 * Sets a custom management name strategy 185 * 186 * @param nameStrategy name strategy 187 */ 188 void setManagementNameStrategy(ManagementNameStrategy nameStrategy); 189 190 /** 191 * Gets the name this {@link CamelContext} was registered in JMX. 192 * <p/> 193 * The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash 194 * in JMX when having multiple {@link CamelContext}s in the same JVM. Camel will automatic reassign and use 195 * a free name to avoid failing to start. 196 * 197 * @return the management name 198 */ 199 String getManagementName(); 200 201 /** 202 * Gets the version of the this CamelContext. 203 * 204 * @return the version 205 */ 206 String getVersion(); 207 208 /** 209 * Get the status of this CamelContext 210 * 211 * @return the status 212 */ 213 ServiceStatus getStatus(); 214 215 /** 216 * Gets the uptime in a human readable format 217 * 218 * @return the uptime in days/hours/minutes 219 */ 220 String getUptime(); 221 222 /** 223 * Gets the uptime in milli seconds 224 * 225 * @return the uptime in millis seconds 226 */ 227 long getUptimeMillis(); 228 229 // Service Methods 230 //----------------------------------------------------------------------- 231 232 /** 233 * Adds a service to this CamelContext, which allows this CamelContext to control the lifecycle, ensuring 234 * the service is stopped when the CamelContext stops. 235 * <p/> 236 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 237 * The service will also be enlisted in JMX for management (if JMX is enabled). 238 * The service will be started, if its not already started. 239 * 240 * @param object the service 241 * @throws Exception can be thrown when starting the service 242 */ 243 void addService(Object object) throws Exception; 244 245 /** 246 * Adds a service to this CamelContext. 247 * <p/> 248 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 249 * The service will also be enlisted in JMX for management (if JMX is enabled). 250 * The service will be started, if its not already started. 251 * <p/> 252 * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring 253 * the service is stopped when the CamelContext stops. 254 * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops. 255 * 256 * @param object the service 257 * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. 258 * @throws Exception can be thrown when starting the service 259 */ 260 void addService(Object object, boolean stopOnShutdown) throws Exception; 261 262 /** 263 * Adds a service to this CamelContext. 264 * <p/> 265 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 266 * The service will also be enlisted in JMX for management (if JMX is enabled). 267 * The service will be started, if its not already started. 268 * <p/> 269 * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring 270 * the service is stopped when the CamelContext stops. 271 * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops. 272 * 273 * @param object the service 274 * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. 275 * @param forceStart whether to force starting the service right now, as otherwise the service may be deferred being started 276 * to later using {@link #deferStartService(Object, boolean)} 277 * @throws Exception can be thrown when starting the service 278 */ 279 void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception; 280 281 /** 282 * Removes a service from this CamelContext. 283 * <p/> 284 * The service is assumed to have been previously added using {@link #addService(Object)} method. 285 * This method will <b>not</b> change the service lifecycle. 286 * 287 * @param object the service 288 * @throws Exception can be thrown if error removing the service 289 * @return <tt>true</tt> if the service was removed, <tt>false</tt> if no service existed 290 */ 291 boolean removeService(Object object) throws Exception; 292 293 /** 294 * Has the given service already been added to this CamelContext? 295 * 296 * @param object the service 297 * @return <tt>true</tt> if already added, <tt>false</tt> if not. 298 */ 299 boolean hasService(Object object); 300 301 /** 302 * Has the given service type already been added to this CamelContext? 303 * 304 * @param type the class type 305 * @return the service instance or <tt>null</tt> if not already added. 306 */ 307 <T> T hasService(Class<T> type); 308 309 /** 310 * Has the given service type already been added to this CamelContext? 311 * 312 * @param type the class type 313 * @return the services instance or empty set. 314 */ 315 <T> Set<T> hasServices(Class<T> type); 316 317 /** 318 * Defers starting the service until {@link CamelContext} is (almost started) or started and has initialized all its prior services and routes. 319 * <p/> 320 * If {@link CamelContext} is already started then the service is started immediately. 321 * 322 * @param object the service 323 * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. Setting this to <tt>true</tt> will keep a reference to the service in 324 * this {@link CamelContext} until the CamelContext is stopped. So do not use it for short lived services. 325 * @throws Exception can be thrown when starting the service, which is only attempted if {@link CamelContext} has already been started when calling this method. 326 */ 327 void deferStartService(Object object, boolean stopOnShutdown) throws Exception; 328 329 /** 330 * Adds the given listener to be invoked when {@link CamelContext} have just been started. 331 * <p/> 332 * This allows listeners to do any custom work after the routes and other services have been started and are running. 333 * <p/><b>Important:</b> The listener will always be invoked, also if the {@link CamelContext} has already been 334 * started, see the {@link org.apache.camel.StartupListener#onCamelContextStarted(CamelContext, boolean)} method. 335 * 336 * @param listener the listener 337 * @throws Exception can be thrown if {@link CamelContext} is already started and the listener is invoked 338 * and cause an exception to be thrown 339 */ 340 void addStartupListener(StartupListener listener) throws Exception; 341 342 // Component Management Methods 343 //----------------------------------------------------------------------- 344 345 /** 346 * Adds a component to the context. 347 * 348 * @param componentName the name the component is registered as 349 * @param component the component 350 */ 351 void addComponent(String componentName, Component component); 352 353 /** 354 * Is the given component already registered? 355 * 356 * @param componentName the name of the component 357 * @return the registered Component or <tt>null</tt> if not registered 358 */ 359 Component hasComponent(String componentName); 360 361 /** 362 * Gets a component from the CamelContext by name. 363 * <p/> 364 * Notice the returned component will be auto-started. If you do not intend to do that 365 * then use {@link #getComponent(String, boolean, boolean)}. 366 * 367 * @param componentName the name of the component 368 * @return the component 369 */ 370 Component getComponent(String componentName); 371 372 /** 373 * Gets a component from the CamelContext by name. 374 * <p/> 375 * Notice the returned component will be auto-started. If you do not intend to do that 376 * then use {@link #getComponent(String, boolean, boolean)}. 377 * 378 * @param name the name of the component 379 * @param autoCreateComponents whether or not the component should 380 * be lazily created if it does not already exist 381 * @return the component 382 */ 383 Component getComponent(String name, boolean autoCreateComponents); 384 385 /** 386 * Gets a component from the CamelContext by name. 387 * 388 * @param name the name of the component 389 * @param autoCreateComponents whether or not the component should 390 * be lazily created if it does not already exist 391 * @param autoStart whether to auto start the component if {@link CamelContext} is already started. 392 * @return the component 393 */ 394 Component getComponent(String name, boolean autoCreateComponents, boolean autoStart); 395 396 /** 397 * Gets a component from the CamelContext by name and specifying the expected type of component. 398 * 399 * @param name the name to lookup 400 * @param componentType the expected type 401 * @return the component 402 */ 403 <T extends Component> T getComponent(String name, Class<T> componentType); 404 405 /** 406 * Gets a readonly list of names of the components currently registered 407 * 408 * @return a readonly list with the names of the the components 409 */ 410 List<String> getComponentNames(); 411 412 /** 413 * Removes a previously added component. 414 * <p/> 415 * The component being removed will be stopped first. 416 * 417 * @param componentName the component name to remove 418 * @return the previously added component or null if it had not been previously added. 419 */ 420 Component removeComponent(String componentName); 421 422 // Endpoint Management Methods 423 //----------------------------------------------------------------------- 424 425 /** 426 * Gets the {@link org.apache.camel.spi.EndpointRegistry} 427 */ 428 EndpointRegistry<String> getEndpointRegistry(); 429 430 /** 431 * Resolves the given name to an {@link Endpoint} of the specified type. 432 * If the name has a singleton endpoint registered, then the singleton is returned. 433 * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}. 434 * 435 * @param uri the URI of the endpoint 436 * @return the endpoint 437 */ 438 Endpoint getEndpoint(String uri); 439 440 /** 441 * Resolves the given name to an {@link Endpoint} of the specified type. 442 * If the name has a singleton endpoint registered, then the singleton is returned. 443 * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}. 444 * 445 * @param name the name of the endpoint 446 * @param endpointType the expected type 447 * @return the endpoint 448 */ 449 <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType); 450 451 /** 452 * Returns a new {@link Collection} of all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry} 453 * 454 * @return all endpoints 455 */ 456 Collection<Endpoint> getEndpoints(); 457 458 /** 459 * Returns a new {@link Map} containing all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry} 460 * 461 * @return map of endpoints 462 */ 463 Map<String, Endpoint> getEndpointMap(); 464 465 /** 466 * Is the given endpoint already registered in the {@link org.apache.camel.spi.EndpointRegistry} 467 * 468 * @param uri the URI of the endpoint 469 * @return the registered endpoint or <tt>null</tt> if not registered 470 */ 471 Endpoint hasEndpoint(String uri); 472 473 /** 474 * Adds the endpoint to the {@link org.apache.camel.spi.EndpointRegistry} using the given URI. 475 * 476 * @param uri the URI to be used to resolve this endpoint 477 * @param endpoint the endpoint to be added to the registry 478 * @return the old endpoint that was previously registered or <tt>null</tt> if none was registered 479 * @throws Exception if the new endpoint could not be started or the old endpoint could not be stopped 480 */ 481 Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception; 482 483 /** 484 * Removes the endpoint from the {@link org.apache.camel.spi.EndpointRegistry}. 485 * <p/> 486 * The endpoint being removed will be stopped first. 487 * 488 * @param endpoint the endpoint 489 * @throws Exception if the endpoint could not be stopped 490 */ 491 void removeEndpoint(Endpoint endpoint) throws Exception; 492 493 /** 494 * Removes all endpoints with the given URI from the {@link org.apache.camel.spi.EndpointRegistry}. 495 * <p/> 496 * The endpoints being removed will be stopped first. 497 * 498 * @param pattern an uri or pattern to match 499 * @return a collection of endpoints removed which could be empty if there are no endpoints found for the given <tt>pattern</tt> 500 * @throws Exception if at least one endpoint could not be stopped 501 * @see org.apache.camel.util.EndpointHelper#matchEndpoint(CamelContext, String, String) for pattern 502 */ 503 Collection<Endpoint> removeEndpoints(String pattern) throws Exception; 504 505 /** 506 * Registers a {@link org.apache.camel.spi.EndpointStrategy callback} to allow you to do custom 507 * logic when an {@link Endpoint} is about to be registered to the {@link org.apache.camel.spi.EndpointRegistry}. 508 * <p/> 509 * When a callback is added it will be executed on the already registered endpoints allowing you to catch-up 510 * 511 * @param strategy callback to be invoked 512 */ 513 void addRegisterEndpointCallback(EndpointStrategy strategy); 514 515 // Route Management Methods 516 //----------------------------------------------------------------------- 517 518 /** 519 * NOTE: experimental api 520 * 521 * @param routeController the route controller 522 */ 523 void setRouteController(RouteController routeController); 524 525 /** 526 * NOTE: experimental api 527 * 528 * @return the route controller or null if not set. 529 */ 530 RouteController getRouteController(); 531 532 /** 533 * Method to signal to {@link CamelContext} that the process to initialize setup routes is in progress. 534 * 535 * @param done <tt>false</tt> to start the process, call again with <tt>true</tt> to signal its done. 536 * @see #isSetupRoutes() 537 */ 538 void setupRoutes(boolean done); 539 540 /** 541 * Returns a list of the current route definitions 542 * 543 * @return list of the current route definitions 544 */ 545 List<RouteDefinition> getRouteDefinitions(); 546 547 /** 548 * Gets the route definition with the given id 549 * 550 * @param id id of the route 551 * @return the route definition or <tt>null</tt> if not found 552 */ 553 RouteDefinition getRouteDefinition(String id); 554 555 /** 556 * Returns a list of the current REST definitions 557 * 558 * @return list of the current REST definitions 559 */ 560 List<RestDefinition> getRestDefinitions(); 561 562 /** 563 * Adds a collection of rest definitions to the context 564 * 565 * @param restDefinitions the rest(s) definition to add 566 */ 567 void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception; 568 569 /** 570 * Sets a custom {@link org.apache.camel.spi.RestConfiguration} 571 * 572 * @param restConfiguration the REST configuration 573 */ 574 void setRestConfiguration(RestConfiguration restConfiguration); 575 576 /** 577 * Gets the default REST configuration 578 * 579 * @return the configuration, or <tt>null</tt> if none has been configured. 580 */ 581 RestConfiguration getRestConfiguration(); 582 583 /** 584 * Sets a custom {@link org.apache.camel.spi.RestConfiguration} 585 * 586 * @param restConfiguration the REST configuration 587 */ 588 void addRestConfiguration(RestConfiguration restConfiguration); 589 590 /** 591 * Gets the REST configuration for the given component 592 * 593 * @param component the component name to get the configuration 594 * @param defaultIfNotFound determine if the default configuration is returned if there isn't a 595 * specific configuration for the given component 596 * @return the configuration, or <tt>null</tt> if none has been configured. 597 */ 598 RestConfiguration getRestConfiguration(String component, boolean defaultIfNotFound); 599 600 /** 601 * Gets all the RestConfiguration's 602 */ 603 Collection<RestConfiguration> getRestConfigurations(); 604 605 /** 606 * Gets the service call configuration by the given name. If no name is given 607 * the default configuration is returned, see <tt>setServiceCallConfiguration</tt> 608 * 609 * @param serviceName name of service, or <tt>null</tt> to return the default configuration 610 * @return the configuration, or <tt>null</tt> if no configuration has been registered 611 */ 612 ServiceCallConfigurationDefinition getServiceCallConfiguration(String serviceName); 613 614 /** 615 * Sets the default service call configuration 616 * 617 * @param configuration the configuration 618 */ 619 void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration); 620 621 /** 622 * Sets the service call configurations 623 * 624 * @param configurations the configuration list 625 */ 626 void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations); 627 628 /** 629 * Adds the service call configuration 630 * 631 * @param serviceName name of the service 632 * @param configuration the configuration 633 */ 634 void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration); 635 636 /** 637 * Gets the Hystrix configuration by the given name. If no name is given 638 * the default configuration is returned, see <tt>setHystrixConfiguration</tt> 639 * 640 * @param id id of the configuration, or <tt>null</tt> to return the default configuration 641 * @return the configuration, or <tt>null</tt> if no configuration has been registered 642 */ 643 HystrixConfigurationDefinition getHystrixConfiguration(String id); 644 645 /** 646 * Sets the default Hystrix configuration 647 * 648 * @param configuration the configuration 649 */ 650 void setHystrixConfiguration(HystrixConfigurationDefinition configuration); 651 652 /** 653 * Sets the Hystrix configurations 654 * 655 * @param configurations the configuration list 656 */ 657 void setHystrixConfigurations(List<HystrixConfigurationDefinition> configurations); 658 659 /** 660 * Adds the Hystrix configuration 661 * 662 * @param id name of the configuration 663 * @param configuration the configuration 664 */ 665 void addHystrixConfiguration(String id, HystrixConfigurationDefinition configuration); 666 667 /** 668 * Returns the order in which the route inputs was started. 669 * <p/> 670 * The order may not be according to the startupOrder defined on the route. 671 * For example a route could be started manually later, or new routes added at runtime. 672 * 673 * @return a list in the order how routes was started 674 */ 675 List<RouteStartupOrder> getRouteStartupOrder(); 676 677 /** 678 * Returns the current routes in this CamelContext 679 * 680 * @return the current routes 681 */ 682 List<Route> getRoutes(); 683 684 /** 685 * Gets the route with the given id 686 * 687 * @param id id of the route 688 * @return the route or <tt>null</tt> if not found 689 */ 690 Route getRoute(String id); 691 692 /** 693 * Gets the processor from any of the routes which with the given id 694 * 695 * @param id id of the processor 696 * @return the processor or <tt>null</tt> if not found 697 */ 698 Processor getProcessor(String id); 699 700 /** 701 * Gets the processor from any of the routes which with the given id 702 * 703 * @param id id of the processor 704 * @param type the processor type 705 * @return the processor or <tt>null</tt> if not found 706 * @throws java.lang.ClassCastException is thrown if the type is not correct type 707 */ 708 <T extends Processor> T getProcessor(String id, Class<T> type); 709 710 /** 711 * Gets the managed processor client api from any of the routes which with the given id 712 * 713 * @param id id of the processor 714 * @param type the managed processor type from the {@link org.apache.camel.api.management.mbean} package. 715 * @return the processor or <tt>null</tt> if not found 716 * @throws IllegalArgumentException if the type is not compliant 717 */ 718 <T extends ManagedProcessorMBean> T getManagedProcessor(String id, Class<T> type); 719 720 /** 721 * Gets the managed route client api with the given route id 722 * 723 * @param routeId id of the route 724 * @param type the managed route type from the {@link org.apache.camel.api.management.mbean} package. 725 * @return the route or <tt>null</tt> if not found 726 * @throws IllegalArgumentException if the type is not compliant 727 */ 728 <T extends ManagedRouteMBean> T getManagedRoute(String routeId, Class<T> type); 729 730 /** 731 * Gets the managed Camel CamelContext client api 732 */ 733 ManagedCamelContextMBean getManagedCamelContext(); 734 735 /** 736 * Gets the processor definition from any of the routes which with the given id 737 * 738 * @param id id of the processor definition 739 * @return the processor definition or <tt>null</tt> if not found 740 */ 741 ProcessorDefinition getProcessorDefinition(String id); 742 743 /** 744 * Gets the processor definition from any of the routes which with the given id 745 * 746 * @param id id of the processor definition 747 * @param type the processor definition type 748 * @return the processor definition or <tt>null</tt> if not found 749 * @throws java.lang.ClassCastException is thrown if the type is not correct type 750 */ 751 <T extends ProcessorDefinition> T getProcessorDefinition(String id, Class<T> type); 752 753 /** 754 * Adds a collection of routes to this CamelContext using the given builder 755 * to build them. 756 * <p/> 757 * <b>Important:</b> The added routes will <b>only</b> be started, if {@link CamelContext} 758 * is already started. You may want to check the state of {@link CamelContext} before 759 * adding the routes, using the {@link org.apache.camel.CamelContext#getStatus()} method. 760 * <p/> 761 * <b>Important: </b> Each route in the same {@link org.apache.camel.CamelContext} must have an <b>unique</b> route id. 762 * If you use the API from {@link org.apache.camel.CamelContext} or {@link org.apache.camel.model.ModelCamelContext} to add routes, then any 763 * new routes which has a route id that matches an old route, then the old route is replaced by the new route. 764 * 765 * @param builder the builder which will create the routes and add them to this CamelContext 766 * @throws Exception if the routes could not be created for whatever reason 767 */ 768 void addRoutes(RoutesBuilder builder) throws Exception; 769 770 /** 771 * Loads a collection of route definitions from the given {@link java.io.InputStream}. 772 * 773 * @param is input stream with the route(s) definition to add 774 * @throws Exception if the route definitions could not be loaded for whatever reason 775 * @return the route definitions 776 */ 777 RoutesDefinition loadRoutesDefinition(InputStream is) throws Exception; 778 779 /** 780 * Loads a collection of rest definitions from the given {@link java.io.InputStream}. 781 * 782 * @param is input stream with the rest(s) definition to add 783 * @throws Exception if the rest definitions could not be loaded for whatever reason 784 * @return the rest definitions 785 */ 786 RestsDefinition loadRestsDefinition(InputStream is) throws Exception; 787 788 /** 789 * Adds a collection of route definitions to the context 790 * 791 * @param routeDefinitions the route(s) definition to add 792 * @throws Exception if the route definitions could not be created for whatever reason 793 */ 794 void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception; 795 796 /** 797 * Add a route definition to the context 798 * 799 * @param routeDefinition the route definition to add 800 * @throws Exception if the route definition could not be created for whatever reason 801 */ 802 void addRouteDefinition(RouteDefinition routeDefinition) throws Exception; 803 804 /** 805 * Removes a collection of route definitions from the CamelContext - stopping any previously running 806 * routes if any of them are actively running 807 * 808 * @param routeDefinitions route(s) definitions to remove 809 * @throws Exception if the route definitions could not be removed for whatever reason 810 */ 811 void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception; 812 813 /** 814 * Removes a route definition from the CamelContext - stopping any previously running 815 * routes if any of them are actively running 816 * 817 * @param routeDefinition route definition to remove 818 * @throws Exception if the route definition could not be removed for whatever reason 819 */ 820 void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception; 821 822 /** 823 * Starts the given route if it has been previously stopped 824 * 825 * @param route the route to start 826 * @throws Exception is thrown if the route could not be started for whatever reason 827 * @deprecated favor using {@link CamelContext#startRoute(String)} 828 */ 829 @Deprecated 830 void startRoute(RouteDefinition route) throws Exception; 831 832 /** 833 * Starts all the routes which currently is not started. 834 * 835 * @throws Exception is thrown if a route could not be started for whatever reason 836 */ 837 void startAllRoutes() throws Exception; 838 839 /** 840 * Starts the given route if it has been previously stopped 841 * 842 * @param routeId the route id 843 * @throws Exception is thrown if the route could not be started for whatever reason 844 */ 845 void startRoute(String routeId) throws Exception; 846 847 /** 848 * Stops the given route. 849 * 850 * @param route the route to stop 851 * @throws Exception is thrown if the route could not be stopped for whatever reason 852 * @deprecated favor using {@link CamelContext#stopRoute(String)} 853 */ 854 @Deprecated 855 void stopRoute(RouteDefinition route) throws Exception; 856 857 /** 858 * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy}. 859 * 860 * @param routeId the route id 861 * @throws Exception is thrown if the route could not be stopped for whatever reason 862 * @see #suspendRoute(String) 863 */ 864 void stopRoute(String routeId) throws Exception; 865 866 /** 867 * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout. 868 * 869 * @param routeId the route id 870 * @param timeout timeout 871 * @param timeUnit the unit to use 872 * @throws Exception is thrown if the route could not be stopped for whatever reason 873 * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit) 874 */ 875 void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception; 876 877 /** 878 * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout 879 * and optional abortAfterTimeout mode. 880 * 881 * @param routeId the route id 882 * @param timeout timeout 883 * @param timeUnit the unit to use 884 * @param abortAfterTimeout should abort shutdown after timeout 885 * @return <tt>true</tt> if the route is stopped before the timeout 886 * @throws Exception is thrown if the route could not be stopped for whatever reason 887 * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit) 888 */ 889 boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception; 890 891 /** 892 * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy}. 893 * 894 * @param routeId the route id 895 * @throws Exception is thrown if the route could not be shutdown for whatever reason 896 * @deprecated use {@link #stopRoute(String)} and {@link #removeRoute(String)} 897 */ 898 @Deprecated 899 void shutdownRoute(String routeId) throws Exception; 900 901 /** 902 * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout. 903 * 904 * @param routeId the route id 905 * @param timeout timeout 906 * @param timeUnit the unit to use 907 * @throws Exception is thrown if the route could not be shutdown for whatever reason 908 * @deprecated use {@link #stopRoute(String, long, java.util.concurrent.TimeUnit)} and {@link #removeRoute(String)} 909 */ 910 @Deprecated 911 void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception; 912 913 /** 914 * Removes the given route (the route <b>must</b> be stopped before it can be removed). 915 * <p/> 916 * A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route 917 * definition etc. will also be removed. All the resources related to the route will be stopped and cleared. 918 * <p/> 919 * <b>Important:</b> When removing a route, the {@link Endpoint}s which are in the static cache of 920 * {@link org.apache.camel.spi.EndpointRegistry} and are <b>only</b> used by the route (not used by other routes) 921 * will also be removed. But {@link Endpoint}s which may have been created as part of routing messages by the route, 922 * and those endpoints are enlisted in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry} are 923 * <b>not</b> removed. To remove those dynamic kind of endpoints, use the {@link #removeEndpoints(String)} method. 924 * If not removing those endpoints, they will be kept in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry}, 925 * but my eventually be removed (evicted) when they have not been in use for a longer period of time; and the 926 * dynamic cache upper limit is hit, and it evicts the least used endpoints. 927 * <p/> 928 * End users can use this method to remove unwanted routes or temporary routes which no longer is in demand. 929 * 930 * @param routeId the route id 931 * @return <tt>true</tt> if the route was removed, <tt>false</tt> if the route could not be removed because its not stopped 932 * @throws Exception is thrown if the route could not be shutdown for whatever reason 933 */ 934 boolean removeRoute(String routeId) throws Exception; 935 936 /** 937 * Resumes the given route if it has been previously suspended 938 * <p/> 939 * If the route does <b>not</b> support suspension the route will be started instead 940 * 941 * @param routeId the route id 942 * @throws Exception is thrown if the route could not be resumed for whatever reason 943 */ 944 void resumeRoute(String routeId) throws Exception; 945 946 /** 947 * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy}. 948 * <p/> 949 * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) 950 * otherwise the consumers will be stopped. 951 * <p/> 952 * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route. 953 * <p/> 954 * If the route does <b>not</b> support suspension the route will be stopped instead 955 * 956 * @param routeId the route id 957 * @throws Exception is thrown if the route could not be suspended for whatever reason 958 */ 959 void suspendRoute(String routeId) throws Exception; 960 961 /** 962 * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout. 963 * <p/> 964 * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) 965 * otherwise the consumers will be stopped. 966 * <p/> 967 * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route. 968 * <p/> 969 * If the route does <b>not</b> support suspension the route will be stopped instead 970 * 971 * @param routeId the route id 972 * @param timeout timeout 973 * @param timeUnit the unit to use 974 * @throws Exception is thrown if the route could not be suspended for whatever reason 975 */ 976 void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception; 977 978 /** 979 * Returns the current status of the given route 980 * 981 * @param routeId the route id 982 * @return the status for the route 983 */ 984 ServiceStatus getRouteStatus(String routeId); 985 986 /** 987 * Indicates whether current thread is starting route(s). 988 * <p/> 989 * This can be useful to know by {@link LifecycleStrategy} or the likes, in case 990 * they need to react differently. 991 * 992 * @return <tt>true</tt> if current thread is starting route(s), or <tt>false</tt> if not. 993 */ 994 boolean isStartingRoutes(); 995 996 /** 997 * Indicates whether current thread is setting up route(s) as part of starting Camel from spring/blueprint. 998 * <p/> 999 * This can be useful to know by {@link LifecycleStrategy} or the likes, in case 1000 * they need to react differently. 1001 * <p/> 1002 * As the startup procedure of {@link CamelContext} is slightly different when using plain Java versus 1003 * Spring or Blueprint, then we need to know when Spring/Blueprint is setting up the routes, which 1004 * can happen after the {@link CamelContext} itself is in started state, due the asynchronous event nature 1005 * of especially Blueprint. 1006 * 1007 * @return <tt>true</tt> if current thread is setting up route(s), or <tt>false</tt> if not. 1008 */ 1009 boolean isSetupRoutes(); 1010 1011 // Properties 1012 //----------------------------------------------------------------------- 1013 1014 /** 1015 * Returns the type converter used to coerce types from one type to another 1016 * 1017 * @return the converter 1018 */ 1019 TypeConverter getTypeConverter(); 1020 1021 /** 1022 * Returns the type converter registry where type converters can be added or looked up 1023 * 1024 * @return the type converter registry 1025 */ 1026 TypeConverterRegistry getTypeConverterRegistry(); 1027 1028 /** 1029 * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext, 1030 * JNDI or the OSGi Service Registry 1031 * 1032 * @return the registry 1033 */ 1034 Registry getRegistry(); 1035 1036 /** 1037 * Returns the registry used to lookup components by name and as the given type 1038 * 1039 * @param type the registry type such as {@link org.apache.camel.impl.JndiRegistry} 1040 * @return the registry, or <tt>null</tt> if the given type was not found as a registry implementation 1041 */ 1042 <T> T getRegistry(Class<T> type); 1043 1044 /** 1045 * Returns the injector used to instantiate objects by type 1046 * 1047 * @return the injector 1048 */ 1049 Injector getInjector(); 1050 1051 /** 1052 * Returns the management mbean assembler 1053 * 1054 * @return the mbean assembler 1055 */ 1056 ManagementMBeanAssembler getManagementMBeanAssembler(); 1057 1058 /** 1059 * Returns the lifecycle strategies used to handle lifecycle notifications 1060 * 1061 * @return the lifecycle strategies 1062 */ 1063 List<LifecycleStrategy> getLifecycleStrategies(); 1064 1065 /** 1066 * Adds the given lifecycle strategy to be used. 1067 * 1068 * @param lifecycleStrategy the strategy 1069 */ 1070 void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy); 1071 1072 /** 1073 * Resolves a language for creating expressions 1074 * 1075 * @param language name of the language 1076 * @return the resolved language 1077 */ 1078 Language resolveLanguage(String language); 1079 1080 /** 1081 * Parses the given text and resolve any property placeholders - using {{key}}. 1082 * 1083 * @param text the text such as an endpoint uri or the likes 1084 * @return the text with resolved property placeholders 1085 * @throws Exception is thrown if property placeholders was used and there was an error resolving them 1086 */ 1087 String resolvePropertyPlaceholders(String text) throws Exception; 1088 1089 /** 1090 * Returns the configured property placeholder prefix token if and only if the CamelContext has 1091 * property placeholder abilities, otherwise returns {@code null}. 1092 * 1093 * @return the prefix token or {@code null} 1094 */ 1095 String getPropertyPrefixToken(); 1096 1097 /** 1098 * Returns the configured property placeholder suffix token if and only if the CamelContext has 1099 * property placeholder abilities, otherwise returns {@code null}. 1100 * 1101 * @return the suffix token or {@code null} 1102 */ 1103 String getPropertySuffixToken(); 1104 1105 /** 1106 * Gets a readonly list with the names of the languages currently registered. 1107 * 1108 * @return a readonly list with the names of the the languages 1109 */ 1110 List<String> getLanguageNames(); 1111 1112 /** 1113 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away. 1114 * <p/> 1115 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1116 * Why does Camel use too many threads with ProducerTemplate?</a> 1117 * <p/> 1118 * <b>Important:</b> Make sure to call {@link org.apache.camel.ProducerTemplate#stop()} when you are done using the template, 1119 * to clean up any resources. 1120 * <p/> 1121 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 1122 * If no key was defined then it will fallback to a default size of 1000. 1123 * You can also use the {@link org.apache.camel.ProducerTemplate#setMaximumCacheSize(int)} method to use a custom value 1124 * before starting the template. 1125 * 1126 * @return the template 1127 * @throws RuntimeCamelException is thrown if error starting the template 1128 */ 1129 ProducerTemplate createProducerTemplate(); 1130 1131 /** 1132 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away. 1133 * <p/> 1134 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1135 * Why does Camel use too many threads with ProducerTemplate?</a> 1136 * <p/> 1137 * <b>Important:</b> Make sure to call {@link ProducerTemplate#stop()} when you are done using the template, 1138 * to clean up any resources. 1139 * 1140 * @param maximumCacheSize the maximum cache size 1141 * @return the template 1142 * @throws RuntimeCamelException is thrown if error starting the template 1143 */ 1144 ProducerTemplate createProducerTemplate(int maximumCacheSize); 1145 1146 /** 1147 * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away. 1148 * <p/> 1149 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1150 * Why does Camel use too many threads with ProducerTemplate?</a> 1151 * <p/> 1152 * <b>Important:</b> Make sure to call {@link org.apache.camel.FluentProducerTemplate#stop()} when you are done using the template, 1153 * to clean up any resources. 1154 * <p/> 1155 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 1156 * If no key was defined then it will fallback to a default size of 1000. 1157 * You can also use the {@link org.apache.camel.FluentProducerTemplate#setMaximumCacheSize(int)} method to use a custom value 1158 * before starting the template. 1159 * 1160 * @return the template 1161 * @throws RuntimeCamelException is thrown if error starting the template 1162 */ 1163 FluentProducerTemplate createFluentProducerTemplate(); 1164 1165 /** 1166 * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away. 1167 * <p/> 1168 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1169 * Why does Camel use too many threads with ProducerTemplate?</a> 1170 * <p/> 1171 * <b>Important:</b> Make sure to call {@link FluentProducerTemplate#stop()} when you are done using the template, 1172 * to clean up any resources. 1173 * 1174 * @param maximumCacheSize the maximum cache size 1175 * @return the template 1176 * @throws RuntimeCamelException is thrown if error starting the template 1177 */ 1178 FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize); 1179 1180 /** 1181 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away. 1182 * <p/> 1183 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1184 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate. 1185 * <p/> 1186 * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template, 1187 * to clean up any resources. 1188 * <p/> 1189 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 1190 * If no key was defined then it will fallback to a default size of 1000. 1191 * You can also use the {@link org.apache.camel.ConsumerTemplate#setMaximumCacheSize(int)} method to use a custom value 1192 * before starting the template. 1193 * 1194 * @return the template 1195 * @throws RuntimeCamelException is thrown if error starting the template 1196 */ 1197 ConsumerTemplate createConsumerTemplate(); 1198 1199 /** 1200 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away. 1201 * <p/> 1202 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 1203 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate. 1204 * <p/> 1205 * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template, 1206 * to clean up any resources. 1207 * 1208 * @param maximumCacheSize the maximum cache size 1209 * @return the template 1210 * @throws RuntimeCamelException is thrown if error starting the template 1211 */ 1212 ConsumerTemplate createConsumerTemplate(int maximumCacheSize); 1213 1214 /** 1215 * Adds the given interceptor strategy 1216 * 1217 * @param interceptStrategy the strategy 1218 */ 1219 void addInterceptStrategy(InterceptStrategy interceptStrategy); 1220 1221 /** 1222 * Gets the interceptor strategies 1223 * 1224 * @return the list of current interceptor strategies 1225 */ 1226 List<InterceptStrategy> getInterceptStrategies(); 1227 1228 /** 1229 * Gets the default error handler builder which is inherited by the routes 1230 * 1231 * @return the builder 1232 * @deprecated The return type will be switched to {@link ErrorHandlerFactory} in Camel 3.0 1233 */ 1234 @Deprecated 1235 ErrorHandlerBuilder getErrorHandlerBuilder(); 1236 1237 /** 1238 * Sets the default error handler builder which is inherited by the routes 1239 * 1240 * @param errorHandlerBuilder the builder 1241 */ 1242 void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder); 1243 1244 /** 1245 * Gets the default shared thread pool for error handlers which 1246 * leverages this for asynchronous redelivery tasks. 1247 */ 1248 ScheduledExecutorService getErrorHandlerExecutorService(); 1249 1250 /** 1251 * Sets the data formats that can be referenced in the routes. 1252 * 1253 * @param dataFormats the data formats 1254 */ 1255 void setDataFormats(Map<String, DataFormatDefinition> dataFormats); 1256 1257 /** 1258 * Gets the data formats that can be referenced in the routes. 1259 * 1260 * @return the data formats available 1261 */ 1262 Map<String, DataFormatDefinition> getDataFormats(); 1263 1264 /** 1265 * Resolve a data format given its name 1266 * 1267 * @param name the data format name or a reference to it in the {@link Registry} 1268 * @return the resolved data format, or <tt>null</tt> if not found 1269 */ 1270 DataFormat resolveDataFormat(String name); 1271 1272 /** 1273 * Creates the given data format given its name. 1274 * 1275 * @param name the data format name or a reference to a data format factory in the {@link Registry} 1276 * @return the resolved data format, or <tt>null</tt> if not found 1277 */ 1278 DataFormat createDataFormat(String name); 1279 1280 /** 1281 * Resolve a data format definition given its name 1282 * 1283 * @param name the data format definition name or a reference to it in the {@link Registry} 1284 * @return the resolved data format definition, or <tt>null</tt> if not found 1285 */ 1286 DataFormatDefinition resolveDataFormatDefinition(String name); 1287 1288 /** 1289 * Gets the current data format resolver 1290 * 1291 * @return the resolver 1292 */ 1293 DataFormatResolver getDataFormatResolver(); 1294 1295 /** 1296 * Sets a custom data format resolver 1297 * 1298 * @param dataFormatResolver the resolver 1299 */ 1300 void setDataFormatResolver(DataFormatResolver dataFormatResolver); 1301 1302 /** 1303 * Sets the transformers that can be referenced in the routes. 1304 * 1305 * @param transformers the transformers 1306 */ 1307 void setTransformers(List<TransformerDefinition> transformers); 1308 1309 /** 1310 * Gets the transformers that can be referenced in the routes. 1311 * 1312 * @return the transformers available 1313 */ 1314 List<TransformerDefinition> getTransformers(); 1315 1316 /** 1317 * Resolve a transformer given a scheme 1318 * 1319 * @param model data model name. 1320 * @return the resolved transformer, or <tt>null</tt> if not found 1321 */ 1322 Transformer resolveTransformer(String model); 1323 1324 /** 1325 * Resolve a transformer given from/to data type. 1326 * 1327 * @param from from data type 1328 * @param to to data type 1329 * @return the resolved transformer, or <tt>null</tt> if not found 1330 */ 1331 Transformer resolveTransformer(DataType from, DataType to); 1332 1333 /** 1334 * Gets the {@link org.apache.camel.spi.TransformerRegistry} 1335 * @return the TransformerRegistry 1336 */ 1337 TransformerRegistry getTransformerRegistry(); 1338 1339 /** 1340 * Sets the validators that can be referenced in the routes. 1341 * 1342 * @param validators the validators 1343 */ 1344 void setValidators(List<ValidatorDefinition> validators); 1345 1346 /** 1347 * Gets the validators that can be referenced in the routes. 1348 * 1349 * @return the validators available 1350 */ 1351 List<ValidatorDefinition> getValidators(); 1352 1353 /** 1354 * Resolve a validator given from/to data type. 1355 * 1356 * @param type the data type 1357 * @return the resolved validator, or <tt>null</tt> if not found 1358 */ 1359 Validator resolveValidator(DataType type); 1360 1361 /** 1362 * Gets the {@link org.apache.camel.spi.ValidatorRegistry} 1363 * @return the ValidatorRegistry 1364 */ 1365 ValidatorRegistry getValidatorRegistry(); 1366 1367 /** 1368 * @deprecated use {@link #setGlobalOptions(Map) setGlobalOptions(Map<String,String>) instead}. 1369 */ 1370 @Deprecated 1371 void setProperties(Map<String, String> properties); 1372 1373 /** 1374 * Sets global options that can be referenced in the camel context 1375 * <p/> 1376 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1377 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1378 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1379 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1380 * 1381 * @param globalOptions global options that can be referenced in the camel context 1382 */ 1383 void setGlobalOptions(Map<String, String> globalOptions); 1384 1385 /** 1386 * @deprecated use {@link #getGlobalOptions()} instead. 1387 */ 1388 @Deprecated 1389 Map<String, String> getProperties(); 1390 1391 /** 1392 * Gets global options that can be referenced in the camel context. 1393 * <p/> 1394 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1395 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1396 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1397 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1398 * 1399 * @return global options for this context 1400 */ 1401 Map<String, String> getGlobalOptions(); 1402 1403 /** 1404 * @deprecated use {@link #getGlobalOption(String)} instead. 1405 */ 1406 String getProperty(String key); 1407 1408 /** 1409 * Gets the global option value that can be referenced in the camel context 1410 * <p/> 1411 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1412 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1413 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1414 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1415 * 1416 * @return the string value of the global option 1417 */ 1418 String getGlobalOption(String key); 1419 1420 /** 1421 * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF 1422 * 1423 * @return the default factory finder 1424 */ 1425 FactoryFinder getDefaultFactoryFinder(); 1426 1427 /** 1428 * Sets the factory finder resolver to use. 1429 * 1430 * @param resolver the factory finder resolver 1431 */ 1432 void setFactoryFinderResolver(FactoryFinderResolver resolver); 1433 1434 /** 1435 * Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path 1436 * 1437 * @param path the META-INF path 1438 * @return the factory finder 1439 * @throws NoFactoryAvailableException is thrown if a factory could not be found 1440 */ 1441 FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException; 1442 1443 /** 1444 * Returns the class resolver to be used for loading/lookup of classes. 1445 * 1446 * @return the resolver 1447 */ 1448 ClassResolver getClassResolver(); 1449 1450 /** 1451 * Returns the package scanning class resolver 1452 * 1453 * @return the resolver 1454 */ 1455 PackageScanClassResolver getPackageScanClassResolver(); 1456 1457 /** 1458 * Sets the class resolver to be use 1459 * 1460 * @param resolver the resolver 1461 */ 1462 void setClassResolver(ClassResolver resolver); 1463 1464 /** 1465 * Sets the package scanning class resolver to use 1466 * 1467 * @param resolver the resolver 1468 */ 1469 void setPackageScanClassResolver(PackageScanClassResolver resolver); 1470 1471 /** 1472 * Sets a pluggable service pool to use for {@link Producer} pooling. 1473 * 1474 * @param servicePool the pool 1475 */ 1476 void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool); 1477 1478 /** 1479 * Gets the service pool for {@link Producer} pooling. 1480 * 1481 * @return the service pool 1482 */ 1483 ServicePool<Endpoint, Producer> getProducerServicePool(); 1484 1485 /** 1486 * Sets a pluggable service pool to use for {@link PollingConsumer} pooling. 1487 * 1488 * @param servicePool the pool 1489 */ 1490 void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool); 1491 1492 /** 1493 * Gets the service pool for {@link Producer} pooling. 1494 * 1495 * @return the service pool 1496 */ 1497 ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool(); 1498 1499 /** 1500 * Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions 1501 * 1502 * @param factory custom factory to use 1503 */ 1504 void setNodeIdFactory(NodeIdFactory factory); 1505 1506 /** 1507 * Gets the node id factory 1508 * 1509 * @return the node id factory 1510 */ 1511 NodeIdFactory getNodeIdFactory(); 1512 1513 /** 1514 * Gets the management strategy 1515 * 1516 * @return the management strategy 1517 */ 1518 ManagementStrategy getManagementStrategy(); 1519 1520 /** 1521 * Sets the management strategy to use 1522 * 1523 * @param strategy the management strategy 1524 */ 1525 void setManagementStrategy(ManagementStrategy strategy); 1526 1527 /** 1528 * Gets the default tracer 1529 * 1530 * @return the default tracer 1531 */ 1532 InterceptStrategy getDefaultTracer(); 1533 1534 /** 1535 * Sets a custom tracer to be used as the default tracer. 1536 * <p/> 1537 * <b>Note:</b> This must be set before any routes are created, 1538 * changing the default tracer for existing routes is not supported. 1539 * 1540 * @param tracer the custom tracer to use as default tracer 1541 */ 1542 void setDefaultTracer(InterceptStrategy tracer); 1543 1544 /** 1545 * Gets the default backlog tracer 1546 * 1547 * @return the default backlog tracer 1548 */ 1549 InterceptStrategy getDefaultBacklogTracer(); 1550 1551 /** 1552 * Sets a custom backlog tracer to be used as the default backlog tracer. 1553 * <p/> 1554 * <b>Note:</b> This must be set before any routes are created, 1555 * changing the default backlog tracer for existing routes is not supported. 1556 * 1557 * @param backlogTracer the custom tracer to use as default backlog tracer 1558 */ 1559 void setDefaultBacklogTracer(InterceptStrategy backlogTracer); 1560 1561 /** 1562 * Gets the default backlog debugger 1563 * 1564 * @return the default backlog debugger 1565 */ 1566 InterceptStrategy getDefaultBacklogDebugger(); 1567 1568 /** 1569 * Sets a custom backlog debugger to be used as the default backlog debugger. 1570 * <p/> 1571 * <b>Note:</b> This must be set before any routes are created, 1572 * changing the default backlog debugger for existing routes is not supported. 1573 * 1574 * @param backlogDebugger the custom debugger to use as default backlog debugger 1575 */ 1576 void setDefaultBacklogDebugger(InterceptStrategy backlogDebugger); 1577 1578 /** 1579 * Disables using JMX as {@link org.apache.camel.spi.ManagementStrategy}. 1580 * <p/> 1581 * <b>Important:</b> This method must be called <b>before</b> the {@link CamelContext} is started. 1582 * 1583 * @throws IllegalStateException is thrown if the {@link CamelContext} is not in stopped state. 1584 */ 1585 void disableJMX() throws IllegalStateException; 1586 1587 /** 1588 * Gets the inflight repository 1589 * 1590 * @return the repository 1591 */ 1592 InflightRepository getInflightRepository(); 1593 1594 /** 1595 * Sets a custom inflight repository to use 1596 * 1597 * @param repository the repository 1598 */ 1599 void setInflightRepository(InflightRepository repository); 1600 1601 /** 1602 * Gets the {@link org.apache.camel.AsyncProcessor} await manager. 1603 * 1604 * @return the manager 1605 */ 1606 AsyncProcessorAwaitManager getAsyncProcessorAwaitManager(); 1607 1608 /** 1609 * Sets a custom {@link org.apache.camel.AsyncProcessor} await manager. 1610 * 1611 * @param manager the manager 1612 */ 1613 void setAsyncProcessorAwaitManager(AsyncProcessorAwaitManager manager); 1614 1615 /** 1616 * Gets the the application CamelContext class loader which may be helpful for running camel in other containers 1617 * 1618 * @return the application CamelContext class loader 1619 */ 1620 ClassLoader getApplicationContextClassLoader(); 1621 1622 /** 1623 * Sets the application CamelContext class loader 1624 * 1625 * @param classLoader the class loader 1626 */ 1627 void setApplicationContextClassLoader(ClassLoader classLoader); 1628 1629 /** 1630 * Gets the current shutdown strategy 1631 * 1632 * @return the strategy 1633 */ 1634 ShutdownStrategy getShutdownStrategy(); 1635 1636 /** 1637 * Sets a custom shutdown strategy 1638 * 1639 * @param shutdownStrategy the custom strategy 1640 */ 1641 void setShutdownStrategy(ShutdownStrategy shutdownStrategy); 1642 1643 /** 1644 * Gets the current {@link org.apache.camel.spi.ExecutorServiceManager} 1645 * 1646 * @return the manager 1647 */ 1648 ExecutorServiceManager getExecutorServiceManager(); 1649 1650 /** 1651 * Gets the current {@link org.apache.camel.spi.ExecutorServiceStrategy} 1652 * 1653 * @return the manager 1654 * @deprecated use {@link #getExecutorServiceManager()} 1655 */ 1656 @Deprecated 1657 org.apache.camel.spi.ExecutorServiceStrategy getExecutorServiceStrategy(); 1658 1659 /** 1660 * Sets a custom {@link org.apache.camel.spi.ExecutorServiceManager} 1661 * 1662 * @param executorServiceManager the custom manager 1663 */ 1664 void setExecutorServiceManager(ExecutorServiceManager executorServiceManager); 1665 1666 /** 1667 * Gets the current {@link org.apache.camel.spi.ProcessorFactory} 1668 * 1669 * @return the factory, can be <tt>null</tt> if no custom factory has been set 1670 */ 1671 ProcessorFactory getProcessorFactory(); 1672 1673 /** 1674 * Sets a custom {@link org.apache.camel.spi.ProcessorFactory} 1675 * 1676 * @param processorFactory the custom factory 1677 */ 1678 void setProcessorFactory(ProcessorFactory processorFactory); 1679 1680 /** 1681 * Gets the current {@link org.apache.camel.spi.MessageHistoryFactory} 1682 * 1683 * @return the factory 1684 */ 1685 MessageHistoryFactory getMessageHistoryFactory(); 1686 1687 /** 1688 * Sets a custom {@link org.apache.camel.spi.MessageHistoryFactory} 1689 * 1690 * @param messageHistoryFactory the custom factory 1691 */ 1692 void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory); 1693 1694 /** 1695 * Gets the current {@link Debugger} 1696 * 1697 * @return the debugger 1698 */ 1699 Debugger getDebugger(); 1700 1701 /** 1702 * Sets a custom {@link Debugger} 1703 * 1704 * @param debugger the debugger 1705 */ 1706 void setDebugger(Debugger debugger); 1707 1708 /** 1709 * Gets the current {@link UuidGenerator} 1710 * 1711 * @return the uuidGenerator 1712 */ 1713 UuidGenerator getUuidGenerator(); 1714 1715 /** 1716 * Sets a custom {@link UuidGenerator} (should only be set once) 1717 * 1718 * @param uuidGenerator the UUID Generator 1719 */ 1720 void setUuidGenerator(UuidGenerator uuidGenerator); 1721 1722 /** 1723 * Whether or not type converters should be loaded lazy 1724 * 1725 * @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup 1726 * @deprecated this option is no longer supported, will be removed in a future Camel release. 1727 */ 1728 @Deprecated 1729 Boolean isLazyLoadTypeConverters(); 1730 1731 /** 1732 * Sets whether type converters should be loaded lazy 1733 * 1734 * @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup 1735 * @deprecated this option is no longer supported, will be removed in a future Camel release. 1736 */ 1737 @Deprecated 1738 void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters); 1739 1740 /** 1741 * Sets whether to load custom type converters by scanning classpath. 1742 * This can be turned off if you are only using Camel components 1743 * that does not provide type converters which is needed at runtime. 1744 * In such situations setting this option to false, can speedup starting 1745 * Camel. 1746 */ 1747 Boolean isLoadTypeConverters(); 1748 1749 /** 1750 * Sets whether to load custom type converters by scanning classpath. 1751 * This can be turned off if you are only using Camel components 1752 * that does not provide type converters which is needed at runtime. 1753 * In such situations setting this option to false, can speedup starting 1754 * Camel. 1755 * 1756 * @param loadTypeConverters whether to load custom type converters. 1757 */ 1758 void setLoadTypeConverters(Boolean loadTypeConverters); 1759 1760 /** 1761 * Whether or not type converter statistics is enabled. 1762 * <p/> 1763 * By default the type converter utilization statistics is disabled. 1764 * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load. 1765 * 1766 * @return <tt>true</tt> if enabled, <tt>false</tt> if disabled (default). 1767 */ 1768 Boolean isTypeConverterStatisticsEnabled(); 1769 1770 /** 1771 * Sets whether or not type converter statistics is enabled. 1772 * <p/> 1773 * By default the type converter utilization statistics is disabled. 1774 * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load. 1775 * <p/> 1776 * You can enable/disable the statistics at runtime using the 1777 * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method, 1778 * or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean. 1779 * 1780 * @param typeConverterStatisticsEnabled <tt>true</tt> to enable, <tt>false</tt> to disable 1781 */ 1782 void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled); 1783 1784 /** 1785 * Whether or not <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> logging is being enabled. 1786 * 1787 * @return <tt>true</tt> if MDC logging is enabled 1788 */ 1789 Boolean isUseMDCLogging(); 1790 1791 /** 1792 * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled. 1793 * 1794 * @param useMDCLogging <tt>true</tt> to enable MDC logging, <tt>false</tt> to disable 1795 */ 1796 void setUseMDCLogging(Boolean useMDCLogging); 1797 1798 /** 1799 * Whether to enable using data type on Camel messages. 1800 * <p/> 1801 * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. 1802 * Otherwise data type is default off. 1803 * 1804 * @return <tt>true</tt> if data type is enabled 1805 */ 1806 Boolean isUseDataType(); 1807 1808 /** 1809 * Whether to enable using data type on Camel messages. 1810 * <p/> 1811 * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. 1812 * Otherwise data type is default off. 1813 * 1814 * @param useDataType <tt>true</tt> to enable data type on Camel messages. 1815 */ 1816 void setUseDataType(Boolean useDataType); 1817 1818 /** 1819 * Whether or not breadcrumb is enabled. 1820 * 1821 * @return <tt>true</tt> if breadcrumb is enabled 1822 */ 1823 Boolean isUseBreadcrumb(); 1824 1825 /** 1826 * Set whether breadcrumb is enabled. 1827 * 1828 * @param useBreadcrumb <tt>true</tt> to enable breadcrumb, <tt>false</tt> to disable 1829 */ 1830 void setUseBreadcrumb(Boolean useBreadcrumb); 1831 1832 /** 1833 * Resolves a component's default name from its java type. 1834 * <p/> 1835 * A component may be used with a non default name such as <tt>activemq</tt>, <tt>wmq</tt> for the JMS component. 1836 * This method can resolve the default component name by its java type. 1837 * 1838 * @param javaType the FQN name of the java type 1839 * @return the default component name. 1840 */ 1841 String resolveComponentDefaultName(String javaType); 1842 1843 /** 1844 * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}. 1845 * 1846 * @return a map with the component name, and value with component details. 1847 * @throws LoadPropertiesException is thrown if error during classpath discovery of the components 1848 * @throws IOException is thrown if error during classpath discovery of the components 1849 */ 1850 Map<String, Properties> findComponents() throws LoadPropertiesException, IOException; 1851 1852 /** 1853 * Find information about all the EIPs from camel-core. 1854 * 1855 * @return a map with node id, and value with EIP details. 1856 * @throws LoadPropertiesException is thrown if error during classpath discovery of the EIPs 1857 * @throws IOException is thrown if error during classpath discovery of the EIPs 1858 */ 1859 Map<String, Properties> findEips() throws LoadPropertiesException, IOException; 1860 1861 /** 1862 * Returns the HTML documentation for the given Camel component 1863 * 1864 * @return the HTML or <tt>null</tt> if the component is <b>not</b> built with HTML document included. 1865 * @deprecated use camel-catalog instead 1866 */ 1867 @Deprecated 1868 String getComponentDocumentation(String componentName) throws IOException; 1869 1870 /** 1871 * Returns the JSON schema representation of the component and endpoint parameters for the given component name. 1872 * 1873 * @return the json or <tt>null</tt> if the component is <b>not</b> built with JSon schema support 1874 */ 1875 String getComponentParameterJsonSchema(String componentName) throws IOException; 1876 1877 /** 1878 * Returns the JSON schema representation of the {@link DataFormat} parameters for the given data format name. 1879 * 1880 * @return the json or <tt>null</tt> if the data format does not exist 1881 */ 1882 String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException; 1883 1884 /** 1885 * Returns the JSON schema representation of the {@link Language} parameters for the given language name. 1886 * 1887 * @return the json or <tt>null</tt> if the language does not exist 1888 */ 1889 String getLanguageParameterJsonSchema(String languageName) throws IOException; 1890 1891 /** 1892 * Returns the JSON schema representation of the EIP parameters for the given EIP name. 1893 * 1894 * @return the json or <tt>null</tt> if the EIP does not exist 1895 */ 1896 String getEipParameterJsonSchema(String eipName) throws IOException; 1897 1898 /** 1899 * Returns a JSON schema representation of the EIP parameters for the given EIP by its id. 1900 * 1901 * @param nameOrId the name of the EIP ({@link NamedNode#getShortName()} or a node id to refer to a specific node from the routes. 1902 * @param includeAllOptions whether to include non configured options also (eg default options) 1903 * @return the json or <tt>null</tt> if the eipName or the id was not found 1904 */ 1905 String explainEipJson(String nameOrId, boolean includeAllOptions); 1906 1907 /** 1908 * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id. 1909 * 1910 * @param componentName the name of the component. 1911 * @param includeAllOptions whether to include non configured options also (eg default options) 1912 * @return the json or <tt>null</tt> if the component was not found 1913 */ 1914 String explainComponentJson(String componentName, boolean includeAllOptions); 1915 1916 /** 1917 * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id. 1918 * 1919 * @param dataFormat the data format instance. 1920 * @param includeAllOptions whether to include non configured options also (eg default options) 1921 * @return the json 1922 */ 1923 String explainDataFormatJson(String dataFormatName, DataFormat dataFormat, boolean includeAllOptions); 1924 1925 /** 1926 * Returns a JSON schema representation of the endpoint parameters for the given endpoint uri. 1927 * 1928 * @param uri the endpoint uri 1929 * @param includeAllOptions whether to include non configured options also (eg default options) 1930 * @return the json or <tt>null</tt> if uri parameters is invalid, or the component is <b>not</b> built with JSon schema support 1931 */ 1932 String explainEndpointJson(String uri, boolean includeAllOptions); 1933 1934 /** 1935 * Creates a JSON representation of all the <b>static</b> and <b>dynamic</b> configured endpoints defined in the given route(s). 1936 * 1937 * @param routeId for a particular route, or <tt>null</tt> for all routes 1938 * @return a JSON string 1939 */ 1940 String createRouteStaticEndpointJson(String routeId); 1941 1942 /** 1943 * Creates a JSON representation of all the <b>static</b> (and possible <b>dynamic</b>) configured endpoints defined in the given route(s). 1944 * 1945 * @param routeId for a particular route, or <tt>null</tt> for all routes 1946 * @param includeDynamic whether to include dynamic endpoints 1947 * @return a JSON string 1948 */ 1949 String createRouteStaticEndpointJson(String routeId, boolean includeDynamic); 1950 1951 /** 1952 * Gets the {@link StreamCachingStrategy} to use. 1953 */ 1954 StreamCachingStrategy getStreamCachingStrategy(); 1955 1956 /** 1957 * Sets a custom {@link StreamCachingStrategy} to use. 1958 */ 1959 void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy); 1960 1961 /** 1962 * Gets the {@link UnitOfWorkFactory} to use. 1963 */ 1964 UnitOfWorkFactory getUnitOfWorkFactory(); 1965 1966 /** 1967 * Sets a custom {@link UnitOfWorkFactory} to use. 1968 */ 1969 void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory); 1970 1971 /** 1972 * Gets the {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use, or <tt>null</tt> if none is in use. 1973 */ 1974 RuntimeEndpointRegistry getRuntimeEndpointRegistry(); 1975 1976 /** 1977 * Sets a custom {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use. 1978 */ 1979 void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry); 1980 1981 /** 1982 * Gets the {@link org.apache.camel.spi.RestRegistry} to use 1983 */ 1984 RestRegistry getRestRegistry(); 1985 1986 /** 1987 * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use. 1988 */ 1989 void setRestRegistry(RestRegistry restRegistry); 1990 1991 /** 1992 * Adds the given route policy factory 1993 * 1994 * @param routePolicyFactory the factory 1995 */ 1996 void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory); 1997 1998 /** 1999 * Gets the route policy factories 2000 * 2001 * @return the list of current route policy factories 2002 */ 2003 List<RoutePolicyFactory> getRoutePolicyFactories(); 2004 2005 /** 2006 * Returns the JAXB Context factory used to create Models. 2007 * 2008 * @return the JAXB Context factory used to create Models. 2009 */ 2010 ModelJAXBContextFactory getModelJAXBContextFactory(); 2011 2012 /** 2013 * Sets a custom JAXB Context factory to be used 2014 * 2015 * @param modelJAXBContextFactory a JAXB Context factory 2016 */ 2017 void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory); 2018 2019 /** 2020 * Returns the {@link ReloadStrategy} if in use. 2021 * 2022 * @return the strategy, or <tt>null</tt> if none has been configured. 2023 */ 2024 ReloadStrategy getReloadStrategy(); 2025 2026 /** 2027 * Sets a custom {@link ReloadStrategy} to be used 2028 */ 2029 void setReloadStrategy(ReloadStrategy reloadStrategy); 2030 2031 /** 2032 * Gets the associated {@link RuntimeCamelCatalog} for this CamelContext. 2033 */ 2034 RuntimeCamelCatalog getRuntimeCamelCatalog(); 2035 2036 /** 2037 * Gets a list of {@link LogListener}. 2038 */ 2039 Set<LogListener> getLogListeners(); 2040 2041 /** 2042 * Adds a {@link LogListener}. 2043 */ 2044 void addLogListener(LogListener listener); 2045 2046 /** 2047 * Sets the global SSL context parameters. 2048 */ 2049 void setSSLContextParameters(SSLContextParameters sslContextParameters); 2050 2051 /** 2052 * Gets the global SSL context parameters if configured. 2053 */ 2054 SSLContextParameters getSSLContextParameters(); 2055 2056 /** 2057 * Gets the {@link HeadersMapFactory} to use. 2058 */ 2059 HeadersMapFactory getHeadersMapFactory(); 2060 2061 /** 2062 * Sets a custom {@link HeadersMapFactory} to be used. 2063 */ 2064 void setHeadersMapFactory(HeadersMapFactory factory); 2065 2066 /** 2067 * Returns an optional {@link HealthCheckRegistry}, by default no registry is 2068 * present and it must be explicit activated. Components can register/unregister 2069 * health checks in response to life-cycle events (i.e. start/stop). 2070 * 2071 * This registry is not used by the camel context but it is up to the impl to 2072 * properly use it, i.e. 2073 * 2074 * - a RouteController could use the registry to decide to restart a route 2075 * with failing health checks 2076 * - spring boot could integrate such checks within its health endpoint or 2077 * make it available only as separate endpoint. 2078 */ 2079 HealthCheckRegistry getHealthCheckRegistry(); 2080 2081 /** 2082 * Sets a {@link HealthCheckRegistry}. 2083 */ 2084 void setHealthCheckRegistry(HealthCheckRegistry healthCheckRegistry); 2085}