This content has been marked as final.
Show 3 replies
-
1. Re: how to read proxylist from domain.xml using jmx
rhusar Oct 22, 2013 8:39 AM (in response to shankar.kodgal)The best way is to use the CLI:
[standalone@localhost:9999 /] /subsystem=modcluster/mod-cluster-config=configuration:read-attribute(name=proxy-list)
{
"outcome" => "success",
"result" => "localhost:6666"
}
See how to use the API programatically:
The native management API - JBoss AS 7.1 - Project Documentation Editor
-
2. Re: how to read proxylist from domain.xml using jmx
shankar.kodgal Oct 22, 2013 8:32 PM (in response to rhusar)Thanks for the information.
Yes, I can get this from CLI. But how to get same thru programatically?
-
3. Re: Re: how to read proxylist from domain.xml using jmx
rhusar Dec 16, 2013 11:28 AM (in response to shankar.kodgal)Programatically, for example the following prints the JSON result on the standard output:
import java.io.IOException; import java.net.InetAddress; import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.dmr.ModelNode; /** * // TODO: Document this * * @author Radoslav Husar */ public class Main { public static void main(String[] args) throws IOException { ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getByName("localhost"), 9999); ModelNode op = new ModelNode(); op.get("operation").set("read-attribute"); ModelNode address = op.get("address"); address.add("subsystem", "modcluster"); address.add("mod-cluster-config", "configuration"); op.get("name").set("proxy-list"); System.out.println(client.execute(op).toJSONString(false)); } }
The dependencies section in maven could look like this:
<dependencies> <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-appclient</artifactId> <version>7.1.3.Final</version> </dependency> </dependencies>