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