You can automate many aspects of deployment monitoring and management by configuring event listeners on the asset management server and the target servers, to listen for deployment events that include a specific state code.
To create and configure a DeploymentEventListener:
Define a listener service class that implements the interface DeploymentEventListener and the method
deploymentEvent(DeploymentEvent pEvent)
.Configure an instance in Nucleus on the appropriate server and register it with the DeploymentServer or DeploymentAgent as appropriate:
Configure the listener on the asset management server and register it with the
/atg/epub/DeploymentServer
, so it listens for deployment events fired when the deployment changes its state.Configure the listener on the target server and register it with the local
/atg/epub/DeploymentAgent
, so it listens for deployment events fired when an agent changes its state.
For an example, examine the source code for the DeploymentEmailer Listener
class, which is located at:
<ATG10dir>/Publishing/samples/Java
DeploymentEmailer Listener
ATG Content Administration includes this DeploymentEventListener class:
atg.deployment.common.event.DeploymentEmailer
You can use this listener to send email notifications when a deployment succeeds, is interrupted, or fails.
By default, instances of the DeploymentEmailer
class listen for deployment events that are fired when a deployment enters one of the following states:
DEPLOYMENT_COMPLETE
EVENT_INTERRUPT
Any error state such as
ERROR
andERROR_PREPARE
On receiving such an event, the listener sends an email message to a specified recipient.
To set up a DeploymentEmailer
listener, first configure an instance of the DeploymentEmailer
class on the asset management server. For example:
$class=atg.deployment.common.event.DeploymentEmailer SMTPEmailSender=/atg/dynamo/service/SMTPEmail fromAddress=personA@myCompany.com toAddress=personB@myCompany.com useShortMessage=true
The following table describes the properties to configure:
Property | Description |
---|---|
| The ATG provides a standard component of type
For more information on email senders and listeners, see the ATG Platform Programming Guide. |
| The sender’s email address. |
| The destination email address. |
| Specifies the level of message detail: True: The listener sends a short, pager-sized message. False (default): The listener sends a longer, more verbose message. |
| Specifies whether to enable the listener: True (default): The listener is enabled to send email notifications. False: The listener is disabled. |
After the DeploymentEmailer
listener is configured, register it with the /atg/epub/DeploymentServer
by adding it to the list of listeners in the deploymentEventListeners
property.
If you require different functionality for the event listener, create a subclass of DeploymentEmailer
, override its deploymentEvent()
method with your own implementation, and configure an instance of this subclass.