!--a11y-->
Using DeployService Interface in Application
Development 
In application development it is very important that the application can obtain information about events in the overall system. The Deploy Service provides an event system and enables you to register your application in this system using the com.sap.engine.services.deploy.DeployService interface. This enables the application to receive notification of any events that occur throughout the cluster and which may influence its functioning – for example, the addition or removal of components, starting or stopping of related applications, and so on.
To use the functions that Deploy Service provides, you must retrieve the service interface (DeployServiceinterface) from the naming system.

Properties ctxProp; ... ctxProp = new Properties(); ctxProp.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); ctxProp.put(Context.PROVIDER_URL, "localhost:50004"); ctxProp.put(Context.SECURITY_PRINCIPAL, "Administrator"); ctxProp.put(Context.SECURITY_CREDENTIALS, "sap"); ctx = new InitialContext(ctxProp); ... deploy = (DeployService) ctx.lookup("deploy"); |
Once you have retrieved the service interface, you can invoke methods on the DeployService object. For example, you can register the application in the event system by invoking the registerDeployCallback() method.

To use this function, you must also implement the com.sap.engine.services.deploy.DeployListener interface and include in its methods logic for processing the events that occur. The deploy listeners are registered in the com.sap.engine.services.deploy.DeployCallbackImpl class, which is then registered in the Deploy Service.
The interfaces and the classes mentioned above are packed in the Deploy Service component of the J2EE Engine (deploy.sda).
For more information about this API, see the J2EE Engine API documentation in the SAP NetWeaver Developer Studio help.
