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.util.Collection; 021import java.util.List; 022import java.util.Map; 023import java.util.Properties; 024import java.util.Set; 025import java.util.concurrent.ExecutorService; 026import java.util.concurrent.ScheduledExecutorService; 027 028import org.apache.camel.spi.AsyncProcessorAwaitManager; 029import org.apache.camel.spi.CamelBeanPostProcessor; 030import org.apache.camel.spi.CamelContextNameStrategy; 031import org.apache.camel.spi.ClassResolver; 032import org.apache.camel.spi.DataFormat; 033import org.apache.camel.spi.DataFormatResolver; 034import org.apache.camel.spi.DataType; 035import org.apache.camel.spi.Debugger; 036import org.apache.camel.spi.EndpointRegistry; 037import org.apache.camel.spi.EndpointStrategy; 038import org.apache.camel.spi.ExecutorServiceManager; 039import org.apache.camel.spi.FactoryFinder; 040import org.apache.camel.spi.FactoryFinderResolver; 041import org.apache.camel.spi.HeadersMapFactory; 042import org.apache.camel.spi.InflightRepository; 043import org.apache.camel.spi.Injector; 044import org.apache.camel.spi.InterceptStrategy; 045import org.apache.camel.spi.Language; 046import org.apache.camel.spi.LifecycleStrategy; 047import org.apache.camel.spi.LogListener; 048import org.apache.camel.spi.ManagementMBeanAssembler; 049import org.apache.camel.spi.ManagementNameStrategy; 050import org.apache.camel.spi.ManagementStrategy; 051import org.apache.camel.spi.MessageHistoryFactory; 052import org.apache.camel.spi.ModelJAXBContextFactory; 053import org.apache.camel.spi.NodeIdFactory; 054import org.apache.camel.spi.PackageScanClassResolver; 055import org.apache.camel.spi.ProcessorFactory; 056import org.apache.camel.spi.PropertiesComponent; 057import org.apache.camel.spi.Registry; 058import org.apache.camel.spi.ReloadStrategy; 059import org.apache.camel.spi.RestConfiguration; 060import org.apache.camel.spi.RestRegistry; 061import org.apache.camel.spi.RouteController; 062import org.apache.camel.spi.RoutePolicyFactory; 063import org.apache.camel.spi.RouteStartupOrder; 064import org.apache.camel.spi.RuntimeEndpointRegistry; 065import org.apache.camel.spi.ShutdownStrategy; 066import org.apache.camel.spi.StreamCachingStrategy; 067import org.apache.camel.spi.Transformer; 068import org.apache.camel.spi.TransformerRegistry; 069import org.apache.camel.spi.TypeConverterRegistry; 070import org.apache.camel.spi.UnitOfWorkFactory; 071import org.apache.camel.spi.UuidGenerator; 072import org.apache.camel.spi.Validator; 073import org.apache.camel.spi.ValidatorRegistry; 074import org.apache.camel.support.jsse.SSLContextParameters; 075 076/** 077 * Interface used to represent the CamelContext used to configure routes and the 078 * policies to use during message exchanges between endpoints. 079 * <p/> 080 * The CamelContext offers the following methods to control the lifecycle: 081 * <ul> 082 * <li>{@link #start()} - to start (<b>important:</b> the start method is not blocked, see more details 083 * <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li> 084 * <li>{@link #stop()} - to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)</li> 085 * <li>{@link #suspend()} - to pause routing messages</li> 086 * <li>{@link #resume()} - to resume after a suspend</li> 087 * </ul> 088 * <p/> 089 * <b>Notice:</b> {@link #stop()} and {@link #suspend()} will gracefully stop/suspend routes ensuring any messages 090 * in progress will be given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}. 091 * <p/> 092 * If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster 093 * restart but also allows any internal state to be kept as is. 094 * The stop/start approach will do a <i>cold</i> restart of Camel, where all internal state is reset. 095 * <p/> 096 * End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that 097 * when it's being started again using the start method that Camel will operate consistently. 098 */ 099public interface CamelContext extends SuspendableService, RuntimeConfiguration { 100 101 /** 102 * Adapts this {@link org.apache.camel.CamelContext} to the specialized type. 103 * <p/> 104 * For example to adapt to <tt>ModelCamelContext</tt>, 105 * or <tt>SpringCamelContext</tt>, or <tt>CdiCamelContext</tt>, etc. 106 * 107 * @param type the type to adapt to 108 * @return this {@link org.apache.camel.CamelContext} adapted to the given type 109 */ 110 <T extends CamelContext> T adapt(Class<T> type); 111 112 /** 113 * Gets the extension of the given type. 114 * 115 * @param type the type of the extension 116 * @return the extension, or <tt>null</tt> if no extension has been installed. 117 */ 118 <T> T getExtension(Class<T> type); 119 120 /** 121 * Allows to install custom extensions to the Camel context. 122 * 123 * @param type the type of the extension 124 * @param module the instance of the extension 125 */ 126 <T> void setExtension(Class<T> type, T module); 127 128 /** 129 * If CamelContext during the start procedure was vetoed, and therefore causing Camel to not start. 130 */ 131 boolean isVetoStarted(); 132 133 /** 134 * Starts the {@link CamelContext} (<b>important:</b> the start method is not blocked, see more details 135 * <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>. 136 * <p/> 137 * See more details at the class-level javadoc of this class. 138 * 139 * @throws Exception is thrown if starting failed 140 */ 141 void start() throws Exception; 142 143 /** 144 * Stop and shutdown the {@link CamelContext} (will stop all routes/components/endpoints etc and clear internal state/cache). 145 * <p/> 146 * See more details at the class-level javadoc of this class. 147 * 148 * @throws Exception is thrown if stopping failed 149 */ 150 void stop() throws Exception; 151 152 /** 153 * Gets the name (id) of the this CamelContext. 154 * 155 * @return the name 156 */ 157 String getName(); 158 159 /** 160 * Gets the current name strategy 161 * 162 * @return name strategy 163 */ 164 CamelContextNameStrategy getNameStrategy(); 165 166 /** 167 * Sets a custom name strategy 168 * 169 * @param nameStrategy name strategy 170 */ 171 void setNameStrategy(CamelContextNameStrategy nameStrategy); 172 173 /** 174 * Gets the current management name strategy 175 * 176 * @return management name strategy 177 */ 178 ManagementNameStrategy getManagementNameStrategy(); 179 180 /** 181 * Sets a custom management name strategy 182 * 183 * @param nameStrategy name strategy 184 */ 185 void setManagementNameStrategy(ManagementNameStrategy nameStrategy); 186 187 /** 188 * Gets the name this {@link CamelContext} was registered in JMX. 189 * <p/> 190 * The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash 191 * in JMX when having multiple {@link CamelContext}s in the same JVM. Camel will automatic reassign and use 192 * a free name to avoid failing to start. 193 * 194 * @return the management name 195 */ 196 String getManagementName(); 197 198 /** 199 * Sets the name this {@link CamelContext} will be registered in JMX. 200 */ 201 void setManagementName(String name); 202 203 /** 204 * Gets the version of the this CamelContext. 205 * 206 * @return the version 207 */ 208 String getVersion(); 209 210 /** 211 * Get the status of this CamelContext 212 * 213 * @return the status 214 */ 215 ServiceStatus getStatus(); 216 217 /** 218 * Gets the uptime in a human readable format 219 * 220 * @return the uptime in days/hours/minutes 221 */ 222 String getUptime(); 223 224 /** 225 * Gets the uptime in milli seconds 226 * 227 * @return the uptime in millis seconds 228 */ 229 long getUptimeMillis(); 230 231 // Service Methods 232 //----------------------------------------------------------------------- 233 234 /** 235 * Adds a service to this CamelContext, which allows this CamelContext to control the lifecycle, ensuring 236 * the service is stopped when the CamelContext stops. 237 * <p/> 238 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 239 * The service will also be enlisted in JMX for management (if JMX is enabled). 240 * The service will be started, if its not already started. 241 * 242 * @param object the service 243 * @throws Exception can be thrown when starting the service 244 */ 245 void addService(Object object) throws Exception; 246 247 /** 248 * Adds a service to this CamelContext. 249 * <p/> 250 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 251 * The service will also be enlisted in JMX for management (if JMX is enabled). 252 * The service will be started, if its not already started. 253 * <p/> 254 * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring 255 * the service is stopped when the CamelContext stops. 256 * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops. 257 * 258 * @param object the service 259 * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. 260 * @throws Exception can be thrown when starting the service 261 */ 262 void addService(Object object, boolean stopOnShutdown) throws Exception; 263 264 /** 265 * Adds a service to this CamelContext. 266 * <p/> 267 * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}. 268 * The service will also be enlisted in JMX for management (if JMX is enabled). 269 * The service will be started, if its not already started. 270 * <p/> 271 * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring 272 * the service is stopped when the CamelContext stops. 273 * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops. 274 * 275 * @param object the service 276 * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. 277 * @param forceStart whether to force starting the service right now, as otherwise the service may be deferred being started 278 * to later using {@link #deferStartService(Object, boolean)} 279 * @throws Exception can be thrown when starting the service 280 */ 281 void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception; 282 283 /** 284 * Removes a service from this CamelContext. 285 * <p/> 286 * The service is assumed to have been previously added using {@link #addService(Object)} method. 287 * This method will <b>not</b> change the service lifecycle. 288 * 289 * @param object the service 290 * @throws Exception can be thrown if error removing the service 291 * @return <tt>true</tt> if the service was removed, <tt>false</tt> if no service existed 292 */ 293 boolean removeService(Object object) throws Exception; 294 295 /** 296 * Has the given service already been added to this CamelContext? 297 * 298 * @param object the service 299 * @return <tt>true</tt> if already added, <tt>false</tt> if not. 300 */ 301 boolean hasService(Object object); 302 303 /** 304 * Has the given service type already been added to this CamelContext? 305 * 306 * @param type the class type 307 * @return the service instance or <tt>null</tt> if not already added. 308 */ 309 <T> T hasService(Class<T> type); 310 311 /** 312 * Has the given service type already been added to this CamelContext? 313 * 314 * @param type the class type 315 * @return the services instance or empty set. 316 */ 317 <T> Set<T> hasServices(Class<T> type); 318 319 /** 320 * Defers starting the service until {@link CamelContext} is (almost started) or started and has initialized all its prior services and routes. 321 * <p/> 322 * If {@link CamelContext} is already started then the service is started immediately. 323 * 324 * @param object the service 325 * @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 326 * this {@link CamelContext} until the CamelContext is stopped. So do not use it for short lived services. 327 * @throws Exception can be thrown when starting the service, which is only attempted if {@link CamelContext} has already been started when calling this method. 328 */ 329 void deferStartService(Object object, boolean stopOnShutdown) throws Exception; 330 331 /** 332 * Adds the given listener to be invoked when {@link CamelContext} have just been started. 333 * <p/> 334 * This allows listeners to do any custom work after the routes and other services have been started and are running. 335 * <p/><b>Important:</b> The listener will always be invoked, also if the {@link CamelContext} has already been 336 * started, see the {@link org.apache.camel.StartupListener#onCamelContextStarted(CamelContext, boolean)} method. 337 * 338 * @param listener the listener 339 * @throws Exception can be thrown if {@link CamelContext} is already started and the listener is invoked 340 * and cause an exception to be thrown 341 */ 342 void addStartupListener(StartupListener listener) throws Exception; 343 344 // Component Management Methods 345 //----------------------------------------------------------------------- 346 347 /** 348 * Adds a component to the context. 349 * 350 * @param componentName the name the component is registered as 351 * @param component the component 352 */ 353 void addComponent(String componentName, Component component); 354 355 /** 356 * Is the given component already registered? 357 * 358 * @param componentName the name of the component 359 * @return the registered Component or <tt>null</tt> if not registered 360 */ 361 Component hasComponent(String componentName); 362 363 /** 364 * Gets a component from the CamelContext by name. 365 * <p/> 366 * Notice the returned component will be auto-started. If you do not intend to do that 367 * then use {@link #getComponent(String, boolean, boolean)}. 368 * 369 * @param componentName the name of the component 370 * @return the component 371 */ 372 Component getComponent(String componentName); 373 374 /** 375 * Gets a component from the CamelContext by name. 376 * <p/> 377 * Notice the returned component will be auto-started. If you do not intend to do that 378 * then use {@link #getComponent(String, boolean, boolean)}. 379 * 380 * @param name the name of the component 381 * @param autoCreateComponents whether or not the component should 382 * be lazily created if it does not already exist 383 * @return the component 384 */ 385 Component getComponent(String name, boolean autoCreateComponents); 386 387 /** 388 * Gets a component from the CamelContext by name. 389 * 390 * @param name the name of the component 391 * @param autoCreateComponents whether or not the component should 392 * be lazily created if it does not already exist 393 * @param autoStart whether to auto start the component if {@link CamelContext} is already started. 394 * @return the component 395 */ 396 Component getComponent(String name, boolean autoCreateComponents, boolean autoStart); 397 398 /** 399 * Gets a component from the CamelContext by name and specifying the expected type of component. 400 * 401 * @param name the name to lookup 402 * @param componentType the expected type 403 * @return the component 404 */ 405 <T extends Component> T getComponent(String name, Class<T> componentType); 406 407 /** 408 * Gets a readonly list of names of the components currently registered 409 * 410 * @return a readonly list with the names of the components 411 */ 412 List<String> getComponentNames(); 413 414 /** 415 * Removes a previously added component. 416 * <p/> 417 * The component being removed will be stopped first. 418 * 419 * @param componentName the component name to remove 420 * @return the previously added component or null if it had not been previously added. 421 */ 422 Component removeComponent(String componentName); 423 424 // Endpoint Management Methods 425 //----------------------------------------------------------------------- 426 427 /** 428 * Gets the {@link org.apache.camel.spi.EndpointRegistry} 429 */ 430 EndpointRegistry<? extends ValueHolder<String>> getEndpointRegistry(); 431 432 /** 433 * Resolves the given name to an {@link Endpoint} of the specified type. 434 * If the name has a singleton endpoint registered, then the singleton is returned. 435 * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}. 436 * 437 * @param uri the URI of the endpoint 438 * @return the endpoint 439 */ 440 Endpoint getEndpoint(String uri); 441 442 /** 443 * Resolves the given name to an {@link Endpoint} of the specified type. 444 * If the name has a singleton endpoint registered, then the singleton is returned. 445 * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}. 446 * 447 * @param name the name of the endpoint 448 * @param endpointType the expected type 449 * @return the endpoint 450 */ 451 <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType); 452 453 /** 454 * Returns a new {@link Collection} of all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry} 455 * 456 * @return all endpoints 457 */ 458 Collection<Endpoint> getEndpoints(); 459 460 /** 461 * Returns a new {@link Map} containing all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry} 462 * 463 * @return map of endpoints 464 */ 465 Map<String, Endpoint> getEndpointMap(); 466 467 /** 468 * Is the given endpoint already registered in the {@link org.apache.camel.spi.EndpointRegistry} 469 * 470 * @param uri the URI of the endpoint 471 * @return the registered endpoint or <tt>null</tt> if not registered 472 */ 473 Endpoint hasEndpoint(String uri); 474 475 /** 476 * Adds the endpoint to the {@link org.apache.camel.spi.EndpointRegistry} using the given URI. 477 * 478 * @param uri the URI to be used to resolve this endpoint 479 * @param endpoint the endpoint to be added to the registry 480 * @return the old endpoint that was previously registered or <tt>null</tt> if none was registered 481 * @throws Exception if the new endpoint could not be started or the old endpoint could not be stopped 482 */ 483 Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception; 484 485 /** 486 * Removes the endpoint from the {@link org.apache.camel.spi.EndpointRegistry}. 487 * <p/> 488 * The endpoint being removed will be stopped first. 489 * 490 * @param endpoint the endpoint 491 * @throws Exception if the endpoint could not be stopped 492 */ 493 void removeEndpoint(Endpoint endpoint) throws Exception; 494 495 /** 496 * Removes all endpoints with the given URI from the {@link org.apache.camel.spi.EndpointRegistry}. 497 * <p/> 498 * The endpoints being removed will be stopped first. 499 * 500 * @param pattern an uri or pattern to match 501 * @return a collection of endpoints removed which could be empty if there are no endpoints found for the given <tt>pattern</tt> 502 * @throws Exception if at least one endpoint could not be stopped 503 * @see org.apache.camel.support.EndpointHelper#matchEndpoint(CamelContext, String, String) for pattern 504 */ 505 Collection<Endpoint> removeEndpoints(String pattern) throws Exception; 506 507 /** 508 * Registers a {@link org.apache.camel.spi.EndpointStrategy callback} to allow you to do custom 509 * logic when an {@link Endpoint} is about to be registered to the {@link org.apache.camel.spi.EndpointRegistry}. 510 * <p/> 511 * When a callback is added it will be executed on the already registered endpoints allowing you to catch-up 512 * 513 * @param strategy callback to be invoked 514 */ 515 void addRegisterEndpointCallback(EndpointStrategy strategy); 516 517 // Route Management Methods 518 //----------------------------------------------------------------------- 519 520 /** 521 * NOTE: experimental api 522 * 523 * @param routeController the route controller 524 */ 525 void setRouteController(RouteController routeController); 526 527 /** 528 * NOTE: experimental api 529 * 530 * @return the route controller or null if not set. 531 */ 532 RouteController getRouteController(); 533 534 /** 535 * Method to signal to {@link CamelContext} that the process to initialize setup routes is in progress. 536 * 537 * @param done <tt>false</tt> to start the process, call again with <tt>true</tt> to signal its done. 538 * @see #isSetupRoutes() 539 */ 540 void setupRoutes(boolean done); 541 542 /** 543 * Sets a custom {@link org.apache.camel.spi.RestConfiguration} 544 * 545 * @param restConfiguration the REST configuration 546 */ 547 void setRestConfiguration(RestConfiguration restConfiguration); 548 549 /** 550 * Gets the default REST configuration 551 * 552 * @return the configuration, or <tt>null</tt> if none has been configured. 553 */ 554 RestConfiguration getRestConfiguration(); 555 556 /** 557 * Sets a custom {@link org.apache.camel.spi.RestConfiguration} 558 * 559 * @param restConfiguration the REST configuration 560 */ 561 void addRestConfiguration(RestConfiguration restConfiguration); 562 563 /** 564 * Gets the REST configuration for the given component 565 * 566 * @param component the component name to get the configuration 567 * @param defaultIfNotFound determine if the default configuration is returned if there isn't a 568 * specific configuration for the given component 569 * @return the configuration, or <tt>null</tt> if none has been configured. 570 */ 571 RestConfiguration getRestConfiguration(String component, boolean defaultIfNotFound); 572 573 /** 574 * Gets all the RestConfiguration's 575 */ 576 Collection<RestConfiguration> getRestConfigurations(); 577 578 /** 579 * Returns the order in which the route inputs was started. 580 * <p/> 581 * The order may not be according to the startupOrder defined on the route. 582 * For example a route could be started manually later, or new routes added at runtime. 583 * 584 * @return a list in the order how routes was started 585 */ 586 List<RouteStartupOrder> getRouteStartupOrder(); 587 588 /** 589 * Returns the current routes in this CamelContext 590 * 591 * @return the current routes 592 */ 593 List<Route> getRoutes(); 594 595 /** 596 * Gets the route with the given id 597 * 598 * @param id id of the route 599 * @return the route or <tt>null</tt> if not found 600 */ 601 Route getRoute(String id); 602 603 /** 604 * Gets the processor from any of the routes which with the given id 605 * 606 * @param id id of the processor 607 * @return the processor or <tt>null</tt> if not found 608 */ 609 Processor getProcessor(String id); 610 611 /** 612 * Gets the processor from any of the routes which with the given id 613 * 614 * @param id id of the processor 615 * @param type the processor type 616 * @return the processor or <tt>null</tt> if not found 617 * @throws java.lang.ClassCastException is thrown if the type is not correct type 618 */ 619 <T extends Processor> T getProcessor(String id, Class<T> type); 620 621 /** 622 * Adds a collection of routes to this CamelContext using the given builder 623 * to build them. 624 * <p/> 625 * <b>Important:</b> The added routes will <b>only</b> be started, if {@link CamelContext} 626 * is already started. You may want to check the state of {@link CamelContext} before 627 * adding the routes, using the {@link org.apache.camel.CamelContext#getStatus()} method. 628 * <p/> 629 * <b>Important: </b> Each route in the same {@link org.apache.camel.CamelContext} must have an <b>unique</b> route id. 630 * If you use the API from {@link org.apache.camel.CamelContext} or {@link org.apache.camel.model.ModelCamelContext} to add routes, then any 631 * new routes which has a route id that matches an old route, then the old route is replaced by the new route. 632 * 633 * @param builder the builder which will create the routes and add them to this CamelContext 634 * @throws Exception if the routes could not be created for whatever reason 635 */ 636 void addRoutes(RoutesBuilder builder) throws Exception; 637 638 /** 639 * Removes the given route (the route <b>must</b> be stopped before it can be removed). 640 * <p/> 641 * A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route 642 * definition etc. will also be removed. All the resources related to the route will be stopped and cleared. 643 * <p/> 644 * <b>Important:</b> When removing a route, the {@link Endpoint}s which are in the static cache of 645 * {@link org.apache.camel.spi.EndpointRegistry} and are <b>only</b> used by the route (not used by other routes) 646 * will also be removed. But {@link Endpoint}s which may have been created as part of routing messages by the route, 647 * and those endpoints are enlisted in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry} are 648 * <b>not</b> removed. To remove those dynamic kind of endpoints, use the {@link #removeEndpoints(String)} method. 649 * If not removing those endpoints, they will be kept in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry}, 650 * but my eventually be removed (evicted) when they have not been in use for a longer period of time; and the 651 * dynamic cache upper limit is hit, and it evicts the least used endpoints. 652 * <p/> 653 * End users can use this method to remove unwanted routes or temporary routes which no longer is in demand. 654 * 655 * @param routeId the route id 656 * @return <tt>true</tt> if the route was removed, <tt>false</tt> if the route could not be removed because its not stopped 657 * @throws Exception is thrown if the route could not be shutdown for whatever reason 658 */ 659 boolean removeRoute(String routeId) throws Exception; 660 661 /** 662 * Indicates whether current thread is setting up route(s) as part of starting Camel from spring/blueprint. 663 * <p/> 664 * This can be useful to know by {@link LifecycleStrategy} or the likes, in case 665 * they need to react differently. 666 * <p/> 667 * As the startup procedure of {@link CamelContext} is slightly different when using plain Java versus 668 * Spring or Blueprint, then we need to know when Spring/Blueprint is setting up the routes, which 669 * can happen after the {@link CamelContext} itself is in started state, due the asynchronous event nature 670 * of especially Blueprint. 671 * 672 * @return <tt>true</tt> if current thread is setting up route(s), or <tt>false</tt> if not. 673 */ 674 boolean isSetupRoutes(); 675 676 // Properties 677 //----------------------------------------------------------------------- 678 679 /** 680 * Returns the type converter used to coerce types from one type to another 681 * 682 * @return the converter 683 */ 684 TypeConverter getTypeConverter(); 685 686 /** 687 * Returns the type converter registry where type converters can be added or looked up 688 * 689 * @return the type converter registry 690 */ 691 TypeConverterRegistry getTypeConverterRegistry(); 692 693 /** 694 * Configures the type converter registry to use, where type converters can be added or looked up. 695 * 696 * @param typeConverterRegistry the registry to use 697 */ 698 void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry); 699 700 /** 701 * Returns the registry used to lookup components by name and type such as SimpleRegistry, Spring ApplicationContext, 702 * JNDI, or the OSGi Service Registry. 703 * 704 * @return the registry 705 */ 706 Registry getRegistry(); 707 708 /** 709 * Returns the registry used to lookup components by name and as the given type 710 * 711 * @param type the registry type such as org.apache.camel.impl.JndiRegistry 712 * @return the registry, or <tt>null</tt> if the given type was not found as a registry implementation 713 */ 714 <T> T getRegistry(Class<T> type); 715 716 /** 717 * Returns the injector used to instantiate objects by type 718 * 719 * @return the injector 720 */ 721 Injector getInjector(); 722 723 /** 724 * Returns the bean post processor used to do any bean customization. 725 * 726 * @return the bean post processor. 727 */ 728 CamelBeanPostProcessor getBeanPostProcessor(); 729 730 /** 731 * Returns the management mbean assembler 732 * 733 * @return the mbean assembler 734 */ 735 ManagementMBeanAssembler getManagementMBeanAssembler(); 736 737 /** 738 * Returns the lifecycle strategies used to handle lifecycle notifications 739 * 740 * @return the lifecycle strategies 741 */ 742 List<LifecycleStrategy> getLifecycleStrategies(); 743 744 /** 745 * Adds the given lifecycle strategy to be used. 746 * 747 * @param lifecycleStrategy the strategy 748 */ 749 void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy); 750 751 /** 752 * Resolves a language for creating expressions 753 * 754 * @param language name of the language 755 * @return the resolved language 756 */ 757 Language resolveLanguage(String language); 758 759 /** 760 * Parses the given text and resolve any property placeholders - using {{key}}. 761 * 762 * @param text the text such as an endpoint uri or the likes 763 * @return the text with resolved property placeholders 764 * @throws Exception is thrown if property placeholders was used and there was an error resolving them 765 */ 766 String resolvePropertyPlaceholders(String text) throws Exception; 767 768 /** 769 * Returns the configured property placeholder prefix token if and only if the CamelContext has 770 * property placeholder abilities, otherwise returns {@code null}. 771 * 772 * @return the prefix token or {@code null} 773 */ 774 String getPropertyPrefixToken(); 775 776 /** 777 * Returns the configured property placeholder suffix token if and only if the CamelContext has 778 * property placeholder abilities, otherwise returns {@code null}. 779 * 780 * @return the suffix token or {@code null} 781 */ 782 String getPropertySuffixToken(); 783 784 /** 785 * Returns the configured properties component or create one if none has been configured. 786 * 787 * @return the properties component 788 */ 789 PropertiesComponent getPropertiesComponent(); 790 791 /** 792 * Returns the configured properties component or create one if none has been configured. 793 * 794 * @param autoCreate whether the component should be created if none is configured 795 * @return the properties component 796 */ 797 PropertiesComponent getPropertiesComponent(boolean autoCreate); 798 799 /** 800 * Gets a readonly list with the names of the languages currently registered. 801 * 802 * @return a readonly list with the names of the languages 803 */ 804 List<String> getLanguageNames(); 805 806 /** 807 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away. 808 * <p/> 809 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 810 * Why does Camel use too many threads with ProducerTemplate?</a> 811 * <p/> 812 * <b>Important:</b> Make sure to call {@link org.apache.camel.ProducerTemplate#stop()} when you are done using the template, 813 * to clean up any resources. 814 * <p/> 815 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 816 * If no key was defined then it will fallback to a default size of 1000. 817 * You can also use the {@link org.apache.camel.ProducerTemplate#setMaximumCacheSize(int)} method to use a custom value 818 * before starting the template. 819 * 820 * @return the template 821 * @throws RuntimeCamelException is thrown if error starting the template 822 */ 823 ProducerTemplate createProducerTemplate(); 824 825 /** 826 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away. 827 * <p/> 828 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 829 * Why does Camel use too many threads with ProducerTemplate?</a> 830 * <p/> 831 * <b>Important:</b> Make sure to call {@link ProducerTemplate#stop()} when you are done using the template, 832 * to clean up any resources. 833 * 834 * @param maximumCacheSize the maximum cache size 835 * @return the template 836 * @throws RuntimeCamelException is thrown if error starting the template 837 */ 838 ProducerTemplate createProducerTemplate(int maximumCacheSize); 839 840 /** 841 * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away. 842 * <p/> 843 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 844 * Why does Camel use too many threads with ProducerTemplate?</a> 845 * <p/> 846 * <b>Important:</b> Make sure to call {@link org.apache.camel.FluentProducerTemplate#stop()} when you are done using the template, 847 * to clean up any resources. 848 * <p/> 849 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 850 * If no key was defined then it will fallback to a default size of 1000. 851 * You can also use the {@link org.apache.camel.FluentProducerTemplate#setMaximumCacheSize(int)} method to use a custom value 852 * before starting the template. 853 * 854 * @return the template 855 * @throws RuntimeCamelException is thrown if error starting the template 856 */ 857 FluentProducerTemplate createFluentProducerTemplate(); 858 859 /** 860 * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away. 861 * <p/> 862 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 863 * Why does Camel use too many threads with ProducerTemplate?</a> 864 * <p/> 865 * <b>Important:</b> Make sure to call {@link FluentProducerTemplate#stop()} when you are done using the template, 866 * to clean up any resources. 867 * 868 * @param maximumCacheSize the maximum cache size 869 * @return the template 870 * @throws RuntimeCamelException is thrown if error starting the template 871 */ 872 FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize); 873 874 /** 875 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away. 876 * <p/> 877 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 878 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate. 879 * <p/> 880 * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template, 881 * to clean up any resources. 882 * <p/> 883 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}. 884 * If no key was defined then it will fallback to a default size of 1000. 885 * You can also use the {@link org.apache.camel.ConsumerTemplate#setMaximumCacheSize(int)} method to use a custom value 886 * before starting the template. 887 * 888 * @return the template 889 * @throws RuntimeCamelException is thrown if error starting the template 890 */ 891 ConsumerTemplate createConsumerTemplate(); 892 893 /** 894 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away. 895 * <p/> 896 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html"> 897 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate. 898 * <p/> 899 * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template, 900 * to clean up any resources. 901 * 902 * @param maximumCacheSize the maximum cache size 903 * @return the template 904 * @throws RuntimeCamelException is thrown if error starting the template 905 */ 906 ConsumerTemplate createConsumerTemplate(int maximumCacheSize); 907 908 /** 909 * Creates a new multicast processor which sends an exchange to all the processors. 910 * 911 * @param processors the list of processors to send to 912 * @param executor the executor to use 913 * @return a multicasting processor 914 */ 915 AsyncProcessor createMulticast(Collection<Processor> processors, 916 ExecutorService executor, boolean shutdownExecutorService); 917 918 /** 919 * Adds the given interceptor strategy 920 * 921 * @param interceptStrategy the strategy 922 */ 923 void addInterceptStrategy(InterceptStrategy interceptStrategy); 924 925 /** 926 * Gets the interceptor strategies 927 * 928 * @return the list of current interceptor strategies 929 */ 930 List<InterceptStrategy> getInterceptStrategies(); 931 932 /** 933 * Gets the default error handler builder which is inherited by the routes 934 * 935 * @return the builder 936 */ 937 ErrorHandlerFactory getErrorHandlerFactory(); 938 939 /** 940 * Sets the default error handler builder which is inherited by the routes 941 * 942 * @param errorHandlerFactory the builder 943 */ 944 void setErrorHandlerFactory(ErrorHandlerFactory errorHandlerFactory); 945 946 /** 947 * Gets the default shared thread pool for error handlers which 948 * leverages this for asynchronous redelivery tasks. 949 */ 950 ScheduledExecutorService getErrorHandlerExecutorService(); 951 952 /** 953 * Resolve a data format given its name 954 * 955 * @param name the data format name or a reference to it in the {@link Registry} 956 * @return the resolved data format, or <tt>null</tt> if not found 957 */ 958 DataFormat resolveDataFormat(String name); 959 960 /** 961 * Creates the given data format given its name. 962 * 963 * @param name the data format name or a reference to a data format factory in the {@link Registry} 964 * @return the resolved data format, or <tt>null</tt> if not found 965 */ 966 DataFormat createDataFormat(String name); 967 968 /** 969 * Gets the current data format resolver 970 * 971 * @return the resolver 972 */ 973 DataFormatResolver getDataFormatResolver(); 974 975 /** 976 * Sets a custom data format resolver 977 * 978 * @param dataFormatResolver the resolver 979 */ 980 void setDataFormatResolver(DataFormatResolver dataFormatResolver); 981 982 /** 983 * Resolve a transformer given a scheme 984 * 985 * @param model data model name. 986 * @return the resolved transformer, or <tt>null</tt> if not found 987 */ 988 Transformer resolveTransformer(String model); 989 990 /** 991 * Resolve a transformer given from/to data type. 992 * 993 * @param from from data type 994 * @param to to data type 995 * @return the resolved transformer, or <tt>null</tt> if not found 996 */ 997 Transformer resolveTransformer(DataType from, DataType to); 998 999 /** 1000 * Gets the {@link org.apache.camel.spi.TransformerRegistry} 1001 * @return the TransformerRegistry 1002 */ 1003 TransformerRegistry<? extends ValueHolder<String>> getTransformerRegistry(); 1004 1005 /** 1006 * Resolve a validator given from/to data type. 1007 * 1008 * @param type the data type 1009 * @return the resolved validator, or <tt>null</tt> if not found 1010 */ 1011 Validator resolveValidator(DataType type); 1012 1013 /** 1014 * Gets the {@link org.apache.camel.spi.ValidatorRegistry} 1015 * @return the ValidatorRegistry 1016 */ 1017 ValidatorRegistry<? extends ValueHolder<String>> getValidatorRegistry(); 1018 1019 /** 1020 * Sets global options that can be referenced in the camel context 1021 * <p/> 1022 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1023 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1024 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1025 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1026 * 1027 * @param globalOptions global options that can be referenced in the camel context 1028 */ 1029 void setGlobalOptions(Map<String, String> globalOptions); 1030 1031 /** 1032 * Gets global options that can be referenced in the camel context. 1033 * <p/> 1034 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1035 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1036 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1037 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1038 * 1039 * @return global options for this context 1040 */ 1041 Map<String, String> getGlobalOptions(); 1042 1043 /** 1044 * Gets the global option value that can be referenced in the camel context 1045 * <p/> 1046 * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs 1047 * which are used to configure global options on CamelContext, such as a maximum debug logging length etc. 1048 * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details 1049 * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation. 1050 * 1051 * @return the string value of the global option 1052 */ 1053 String getGlobalOption(String key); 1054 1055 /** 1056 * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF 1057 * 1058 * @return the default factory finder 1059 */ 1060 FactoryFinder getDefaultFactoryFinder(); 1061 1062 /** 1063 * Sets the factory finder resolver to use. 1064 * 1065 * @param resolver the factory finder resolver 1066 */ 1067 void setFactoryFinderResolver(FactoryFinderResolver resolver); 1068 1069 /** 1070 * Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path 1071 * 1072 * @param path the META-INF path 1073 * @return the factory finder 1074 * @throws NoFactoryAvailableException is thrown if a factory could not be found 1075 */ 1076 FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException; 1077 1078 /** 1079 * Returns the class resolver to be used for loading/lookup of classes. 1080 * 1081 * @return the resolver 1082 */ 1083 ClassResolver getClassResolver(); 1084 1085 /** 1086 * Returns the package scanning class resolver 1087 * 1088 * @return the resolver 1089 */ 1090 PackageScanClassResolver getPackageScanClassResolver(); 1091 1092 /** 1093 * Sets the class resolver to be use 1094 * 1095 * @param resolver the resolver 1096 */ 1097 void setClassResolver(ClassResolver resolver); 1098 1099 /** 1100 * Sets the package scanning class resolver to use 1101 * 1102 * @param resolver the resolver 1103 */ 1104 void setPackageScanClassResolver(PackageScanClassResolver resolver); 1105 1106 /** 1107 * Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions 1108 * 1109 * @param factory custom factory to use 1110 */ 1111 void setNodeIdFactory(NodeIdFactory factory); 1112 1113 /** 1114 * Gets the node id factory 1115 * 1116 * @return the node id factory 1117 */ 1118 NodeIdFactory getNodeIdFactory(); 1119 1120 /** 1121 * Gets the management strategy 1122 * 1123 * @return the management strategy 1124 */ 1125 ManagementStrategy getManagementStrategy(); 1126 1127 /** 1128 * Sets the management strategy to use 1129 * 1130 * @param strategy the management strategy 1131 */ 1132 void setManagementStrategy(ManagementStrategy strategy); 1133 1134 /** 1135 * Disables using JMX as {@link org.apache.camel.spi.ManagementStrategy}. 1136 * <p/> 1137 * <b>Important:</b> This method must be called <b>before</b> the {@link CamelContext} is started. 1138 * 1139 * @throws IllegalStateException is thrown if the {@link CamelContext} is not in stopped state. 1140 */ 1141 void disableJMX() throws IllegalStateException; 1142 1143 /** 1144 * Setup management according to whether JMX is enabled or disabled. 1145 * 1146 * @param options optional parameters to configure {@link org.apache.camel.spi.ManagementAgent}. 1147 */ 1148 void setupManagement(Map<String, Object> options); 1149 1150 /** 1151 * Gets the inflight repository 1152 * 1153 * @return the repository 1154 */ 1155 InflightRepository getInflightRepository(); 1156 1157 /** 1158 * Sets a custom inflight repository to use 1159 * 1160 * @param repository the repository 1161 */ 1162 void setInflightRepository(InflightRepository repository); 1163 1164 /** 1165 * Gets the {@link org.apache.camel.AsyncProcessor} await manager. 1166 * 1167 * @return the manager 1168 */ 1169 AsyncProcessorAwaitManager getAsyncProcessorAwaitManager(); 1170 1171 /** 1172 * Sets a custom {@link org.apache.camel.AsyncProcessor} await manager. 1173 * 1174 * @param manager the manager 1175 */ 1176 void setAsyncProcessorAwaitManager(AsyncProcessorAwaitManager manager); 1177 1178 /** 1179 * Gets the application CamelContext class loader which may be helpful for running camel in other containers 1180 * 1181 * @return the application CamelContext class loader 1182 */ 1183 ClassLoader getApplicationContextClassLoader(); 1184 1185 /** 1186 * Sets the application CamelContext class loader 1187 * 1188 * @param classLoader the class loader 1189 */ 1190 void setApplicationContextClassLoader(ClassLoader classLoader); 1191 1192 /** 1193 * Gets the current shutdown strategy 1194 * 1195 * @return the strategy 1196 */ 1197 ShutdownStrategy getShutdownStrategy(); 1198 1199 /** 1200 * Sets a custom shutdown strategy 1201 * 1202 * @param shutdownStrategy the custom strategy 1203 */ 1204 void setShutdownStrategy(ShutdownStrategy shutdownStrategy); 1205 1206 /** 1207 * Gets the current {@link org.apache.camel.spi.ExecutorServiceManager} 1208 * 1209 * @return the manager 1210 */ 1211 ExecutorServiceManager getExecutorServiceManager(); 1212 1213 /** 1214 * Sets a custom {@link org.apache.camel.spi.ExecutorServiceManager} 1215 * 1216 * @param executorServiceManager the custom manager 1217 */ 1218 void setExecutorServiceManager(ExecutorServiceManager executorServiceManager); 1219 1220 /** 1221 * Gets the current {@link org.apache.camel.spi.ProcessorFactory} 1222 * 1223 * @return the factory, can be <tt>null</tt> if no custom factory has been set 1224 */ 1225 ProcessorFactory getProcessorFactory(); 1226 1227 /** 1228 * Sets a custom {@link org.apache.camel.spi.ProcessorFactory} 1229 * 1230 * @param processorFactory the custom factory 1231 */ 1232 void setProcessorFactory(ProcessorFactory processorFactory); 1233 1234 /** 1235 * Gets the current {@link org.apache.camel.spi.MessageHistoryFactory} 1236 * 1237 * @return the factory 1238 */ 1239 MessageHistoryFactory getMessageHistoryFactory(); 1240 1241 /** 1242 * Sets a custom {@link org.apache.camel.spi.MessageHistoryFactory} 1243 * 1244 * @param messageHistoryFactory the custom factory 1245 */ 1246 void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory); 1247 1248 /** 1249 * Gets the current {@link Debugger} 1250 * 1251 * @return the debugger 1252 */ 1253 Debugger getDebugger(); 1254 1255 /** 1256 * Sets a custom {@link Debugger} 1257 * 1258 * @param debugger the debugger 1259 */ 1260 void setDebugger(Debugger debugger); 1261 1262 /** 1263 * Gets the current {@link UuidGenerator} 1264 * 1265 * @return the uuidGenerator 1266 */ 1267 UuidGenerator getUuidGenerator(); 1268 1269 /** 1270 * Sets a custom {@link UuidGenerator} (should only be set once) 1271 * 1272 * @param uuidGenerator the UUID Generator 1273 */ 1274 void setUuidGenerator(UuidGenerator uuidGenerator); 1275 1276 /** 1277 * Whether to load custom type converters by scanning classpath. 1278 * This is used for backwards compatibility with Camel 2.x. 1279 * Its recommended to migrate to use fast type converter loading 1280 * by setting <tt>@Converter(loader = true)</tt> on your custom 1281 * type converter classes. 1282 */ 1283 Boolean isLoadTypeConverters(); 1284 1285 /** 1286 * Whether to load custom type converters by scanning classpath. 1287 * This is used for backwards compatibility with Camel 2.x. 1288 * Its recommended to migrate to use fast type converter loading 1289 * by setting <tt>@Converter(loader = true)</tt> on your custom 1290 * type converter classes. 1291 * 1292 * @param loadTypeConverters whether to load custom type converters using classpath scanning. 1293 */ 1294 void setLoadTypeConverters(Boolean loadTypeConverters); 1295 1296 /** 1297 * Whether or not type converter statistics is enabled. 1298 * <p/> 1299 * By default the type converter utilization statistics is disabled. 1300 * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load. 1301 * 1302 * @return <tt>true</tt> if enabled, <tt>false</tt> if disabled (default). 1303 */ 1304 Boolean isTypeConverterStatisticsEnabled(); 1305 1306 /** 1307 * Sets whether or not type converter statistics is enabled. 1308 * <p/> 1309 * By default the type converter utilization statistics is disabled. 1310 * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load. 1311 * <p/> 1312 * You can enable/disable the statistics at runtime using the 1313 * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method, 1314 * or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean. 1315 * 1316 * @param typeConverterStatisticsEnabled <tt>true</tt> to enable, <tt>false</tt> to disable 1317 */ 1318 void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled); 1319 1320 /** 1321 * Whether or not <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> logging is being enabled. 1322 * 1323 * @return <tt>true</tt> if MDC logging is enabled 1324 */ 1325 Boolean isUseMDCLogging(); 1326 1327 /** 1328 * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled. 1329 * 1330 * @param useMDCLogging <tt>true</tt> to enable MDC logging, <tt>false</tt> to disable 1331 */ 1332 void setUseMDCLogging(Boolean useMDCLogging); 1333 1334 /** 1335 * Whether to enable using data type on Camel messages. 1336 * <p/> 1337 * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. 1338 * Otherwise data type is default off. 1339 * 1340 * @return <tt>true</tt> if data type is enabled 1341 */ 1342 Boolean isUseDataType(); 1343 1344 /** 1345 * Whether to enable using data type on Camel messages. 1346 * <p/> 1347 * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. 1348 * Otherwise data type is default off. 1349 * 1350 * @param useDataType <tt>true</tt> to enable data type on Camel messages. 1351 */ 1352 void setUseDataType(Boolean useDataType); 1353 1354 /** 1355 * Whether or not breadcrumb is enabled. 1356 * 1357 * @return <tt>true</tt> if breadcrumb is enabled 1358 */ 1359 Boolean isUseBreadcrumb(); 1360 1361 /** 1362 * Set whether breadcrumb is enabled. 1363 * 1364 * @param useBreadcrumb <tt>true</tt> to enable breadcrumb, <tt>false</tt> to disable 1365 */ 1366 void setUseBreadcrumb(Boolean useBreadcrumb); 1367 1368 /** 1369 * Gets the {@link StreamCachingStrategy} to use. 1370 */ 1371 StreamCachingStrategy getStreamCachingStrategy(); 1372 1373 /** 1374 * Sets a custom {@link StreamCachingStrategy} to use. 1375 */ 1376 void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy); 1377 1378 /** 1379 * Gets the {@link UnitOfWorkFactory} to use. 1380 */ 1381 UnitOfWorkFactory getUnitOfWorkFactory(); 1382 1383 /** 1384 * Sets a custom {@link UnitOfWorkFactory} to use. 1385 */ 1386 void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory); 1387 1388 /** 1389 * Gets the {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use, or <tt>null</tt> if none is in use. 1390 */ 1391 RuntimeEndpointRegistry getRuntimeEndpointRegistry(); 1392 1393 /** 1394 * Sets a custom {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use. 1395 */ 1396 void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry); 1397 1398 /** 1399 * Gets the {@link org.apache.camel.spi.RestRegistry} to use 1400 */ 1401 RestRegistry getRestRegistry(); 1402 1403 /** 1404 * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use. 1405 */ 1406 void setRestRegistry(RestRegistry restRegistry); 1407 1408 /** 1409 * Adds the given route policy factory 1410 * 1411 * @param routePolicyFactory the factory 1412 */ 1413 void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory); 1414 1415 /** 1416 * Gets the route policy factories 1417 * 1418 * @return the list of current route policy factories 1419 */ 1420 List<RoutePolicyFactory> getRoutePolicyFactories(); 1421 1422 /** 1423 * Returns the JAXB Context factory used to create Models. 1424 * 1425 * @return the JAXB Context factory used to create Models. 1426 */ 1427 ModelJAXBContextFactory getModelJAXBContextFactory(); 1428 1429 /** 1430 * Sets a custom JAXB Context factory to be used 1431 * 1432 * @param modelJAXBContextFactory a JAXB Context factory 1433 */ 1434 void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory); 1435 1436 /** 1437 * Returns the {@link ReloadStrategy} if in use. 1438 * 1439 * @return the strategy, or <tt>null</tt> if none has been configured. 1440 */ 1441 ReloadStrategy getReloadStrategy(); 1442 1443 /** 1444 * Sets a custom {@link ReloadStrategy} to be used 1445 */ 1446 void setReloadStrategy(ReloadStrategy reloadStrategy); 1447 1448 /** 1449 * Gets a list of {@link LogListener}. 1450 */ 1451 Set<LogListener> getLogListeners(); 1452 1453 /** 1454 * Adds a {@link LogListener}. 1455 */ 1456 void addLogListener(LogListener listener); 1457 1458 /** 1459 * Sets the global SSL context parameters. 1460 */ 1461 void setSSLContextParameters(SSLContextParameters sslContextParameters); 1462 1463 /** 1464 * Gets the global SSL context parameters if configured. 1465 */ 1466 SSLContextParameters getSSLContextParameters(); 1467 1468 /** 1469 * Gets the {@link HeadersMapFactory} to use. 1470 */ 1471 HeadersMapFactory getHeadersMapFactory(); 1472 1473 /** 1474 * Sets a custom {@link HeadersMapFactory} to be used. 1475 */ 1476 void setHeadersMapFactory(HeadersMapFactory factory); 1477 1478}