Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to refer ngrinder core in the plugins


When developing plugins, sometimes the plugin might need to refer ngrinder core class's instance. For example, Config or PerfTestService instance which might be necessary to access settings in system.conf or control the perftest processing respectively. You should not create these instances by yourself. These are spring bean managed by spring framework. Only way to get the reference of them is to create the plugin constructor with those class's interfaces.

public class NetworkOverFlow implements OnTestSamplingRunnable {
        private static final Logger LOGGER = LoggerFactory.getLogger(NetworkOverFlow.class);
        private final IConfig config;
        private IAgentManagerService agentManagerService;
        public NetworkOverFlow(IConfig config, IAgentManagerService agentManagerService) {
                this.config = config;
                this.agentManagerService = agentManagerService;
        }
        ....
}

You can get the ngrinder internally managing spring beans by placing the interfaces as constructor's arguments. Those will be passed from ngrinder-core when the plugin is activated. Therefore if the plugin keeps these references in member variables, the plugin can use them in the plugin's methods which are invoked from ngrinder.

Following interfaces which each plugin can bind are available.

 Interface

Usage 

 IConfig

This interface is used to get the system configuration stored in system.conf file.
If the plugin is necessary to be configured before it's invoked, please get the system property using this interface.
You can fine the usage here.

 IPerfTestService

This interface is used to manipulate perf tests. Each plugin can get ans modify the perf tests. Even this allows plugin to stop 
currently executing perf test.
You can fine the usage here.

 IUserService

This interface is used to create the new user who are already validated by the other methods like SSO.

IAgentManagerService

This interface is used to get the agent's current status.
You can find the usage here.




comments powered by Disqus
Page info
viewed 5537 times
translations en
Author
posted last year by
junoyoon
Contributors
updated 9 months ago by
View revisions
tagged
Share this article