To dynamically configure components at server startup, you create a custom Java class that extends the flex.messaging.services.AbstractBootstrapService class and implements the initialize() method of the AbstractBootstrapService class. You can also implement the start(), and stop() methods of the AbstractBootstrapService class; these methods provide hooks to server startup and shutdown in case you need to do special processing, such as starting or stopping the database as the server starts or stops. The following table describes these methods:
|
Method |
Descriptions |
|---|---|
| public abstract void initialize(String id, ConfigMap properties) |
Called by the MessageBroker after all of the server components are created, but just before they are started. Components that you create in this method are started automatically. Usually, you use this method rather than the start() and stop() methods because you want the components configured before the server starts. The id parameter specifies the ID of the AbstractBootstrapService. The properties parameter specifies the properties for the AbstractBootstrapService. |
| public abstract void start() |
Called by the MessageBroker as server starts. You must manually start components that you create in this method. |
| public abstract void stop() |
Called by the MessageBroker as server stops. |
You must register custom bootstrap classes in the services section of the services-config.xml file, as the following example shows. Services are loaded in the order specified. You generally place the static services first, and then place the dynamic services in the order in which you want them to become available.
<services>
<service-include file-path="remoting-config.xml"/>
<service-include file-path="proxy-config.xml"/>
<service-include file-path="messaging-config.xml"/>
<service class="dev.service.MyBootstrapService1" id="bootstrap1"/>
<service id="bootstrap2" class="my.company.BootstrapService2">
<!-- Bootstrap services can also have custom properties that can be
processed in initialize method -->
<properties>
<prop1>value1</prop1>
<prop2>value2</prop2>
</properties>
</service>>
</services>
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/blazeds/1/blazeds_devguide/runtimeconfig_3.html