[wildfly-dev] access to mgmt api/services
John Mazzitelli
mazz at redhat.com
Mon Jan 27 17:40:23 EST 2014
> Is there an example somewhere of getting access to the mgmt api from a
> deployed servlet app? I'd like to be able to manage subsystem
> configuration and store it (within standalone.xml or whatever).
You can take a look at RHQ's DMR client library. It was written to be a generic DMR client to access the mgmt API.
https://git.fedorahosted.org/cgit/rhq/rhq.git/tree/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller
Obtain a ModelControllerClient "somehow" (see MCCHelper, for example) and pass it to the constructor for the different types of clients (DatasourceJBossASClient, CoreJBossASClient, SecurityDomainJBossASClient, etc, etc)
Then there is my blog from 2012 that talks about getting a co-located ModelControllerClient that may be of help:
http://management-platform.blogspot.com/2012/07/co-located-management-client-for.html
Anyway, the code in those places can serve as examples that you are asking for. We do use these from within servlets and EJBs running in EAP 6.
More information about the wildfly-dev
mailing list