Service activator
Writing a Custom OBServiceObserver
WSO2 Open Banking Accelerator contains an OBServiceObserver component that provides a Java interface to manually execute
methods in non-OSGI modules at the server startup time for both Identity Server and API Manager Servers. A new custom
implementation of OBServiceObserver executes as a new thread at runtime.
- To implement a custom
OBServiceObserver, extend the following class:
com.wso2.openbanking.accelerator.service.activator.OBServiceObserver
Given below is a brief explanation of the methods you need to implement.
Activate method
This is a public method without any return type or input parameters. You can customize it according to your requirements. Given below is the method signature:
void activate()
Sample implementation:
import com.wso2.openbanking.accelerator.service.activator.OBServiceObserver;
public class CustomObserver implements OBServiceObserver {
@Override
public void activate() {
// invoke the required method
}
}
Configuring a Custom OBServiceObserver
-
Once implemented, build a JAR file for your
OBServiceObserverand place it in the
<IS_HOME>/repository/components/dropinsand<APIM_HOME>/repository/components/dropinsdirectories. -
Open the
<IS_HOME>/repository/conf/deployment.tomlfile. -
Add a
[open_banking.service_activator.subscribers]tag and configure it using the Fully Qualified Name (FQN) of your customOBServiceObserverimplementation. For example:[[open_banking.service_activator.subscribers]]subscriber="full.qualified.class.name.ObServiceObserverImpl-1"subscriber="full.qualified.class.name.ObServiceObserverImpl-2" -
Save the above configurations and restart the Identity Server.
-
Repeat steps 2 and 3 for API Manager using the
<APIM_HOME>/repository/conf/deployment.tomlfile. -
Restart the API Manager server.
Was this page helpful?