There are three ways to invoke the SitemapGeneratorService
and SitemapWriterService
:
Scheduling them to run automatically at specified times or intervals
Configuring a deployment listener so they are run automatically after a CA deployment
Invoking them manually through the Dynamo Server Admin
After you generate and write out your sitemaps, you must submit them to search engines for indexing. For more information, see sitemaps.org
.
Scheduling
The SitemapGeneratorService
and the SitemapWriterService
classes both extend atg.service.scheduler.SingletonSchedulableService
, so you can schedule components of these classes to run automatically at specified times or intervals. Because these are singleton services, only one instance of each class can run on your Oracle Commerce Platform environment at any given time.
In general, you need to run the SitemapGeneratorService
only after your site is updated. If your site is updated frequently, you might want to configure the service to run once a day at a time when site activity is low. If your site is updated infrequently, rather than scheduling the service, you can invoke it manually through the Dynamo Server Admin or configure a deployment listener to run the service after a CA deployment.
The SitemapWriterService
, on the other hand, can be configured to run frequently. When this service starts up, it checks when the SitemapRepository
was last modified. If the repository has been modified since the SitemapWriterService
last ran, the service runs and writes out the updated sitemaps. If the repository has not been modified since the service last ran, it immediately shuts down.
This mechanism ensures that the SitemapWriterService
runs only if the site has actually changed, and that (assuming the SitemapWriterService
is scheduled to run frequently) there is never a long delay between running the SitemapGeneratorService
and running the SitemapWriterService
. Also, running the SitemapWriterService
on a schedule (rather than invoking it manually) is desirable because you need to run a separate instance of this service on each page-serving Oracle Commerce Platform instance in your production environment (unlike the SitemapGeneratorService
, which can run on a single instance).
To configure the SitemapGeneratorService
or the SitemapWriterService
to run automatically, you set various scheduling and locking properties.
Configuring a Deployment Listener
The PublishingAgent.base
module includes a deployment listener that can trigger the SitemapGeneratorService
to run after a CA deployment. This component is /atg/epub/SitemapGeneratorPolicy
, and by default it is configured like this:
$class=atg.deployment.agent.DeploymentMethodInvocationPolicyImpl object=/atg/sitemap/SitemapGeneratorService methodName=generateSitemaps deploymentState=DEPLOYMENT_COMPLETE failDeploymentOnInvocationError=false active=false
To enable this component, set the active
property to true
.
Manual Invocation through the Dynamo Server Admin
You can invoke the SitemapGeneratorService
or the SitemapWriterService
manually though the Dynamo Server Admin. The top-level page has a Sitemap Administration link that takes you to a page with Generate Sitemaps and Write Sitemaps links.
By default, the Generate Sitemaps link invokes /atg/sitemap/SitemapGeneratorService
, and the Write Sitemaps link invokes /atg/sitemap/SitemapWriterService
. To configure these links to invoke different components, change the values of the sitemapGeneratorService
and sitemapWriterService
properties of /atg/sitemap/SitemapGeneratorFormHandler
.