The JBoss EAP 7 server instance-id is configured on standalone.xml, like this:
<subsystem xmlns="urn:jboss:domain:undertow:3.1" instance-id="node2">
I have and environment with load balancing and sticky session. So, the client receives the JSESSIONID cookies with something like this as value: "ckvLpSqtsN2EjA8WpFqml3UMU5ZIyH2YI29Ir-i.node2".
The question is: I'm on the MBean (with access to FacesContext). How can I get the instance-id of the server that is serving the request? In the above scenario, "node2".
What I already tried:
I have considered avoiding the problem by setting the instance id in an environment variable and configuring standalone.xml to define instance-id="${my.instance.name}". The application, then, reads the environment variable to get the instance-id. This is portable accross AS, but is prone to configuration error. Ideally the application should get exactly what is on instance-id and I don't need the application to be portable.
This question is similar to "Getting instance name of a WebSphere app Server" (Getting instance name of a WebSphere app Server), but for a JBoss EAP 7 server.
I'm not sure it is a bug or a feature, but setting instance-id as described in the question does not change jboss.node.name or jboss.server.name:
However, adding a name="node123" attribute on <server>
tag (the top level element on standalone.xml) and removing the instance-id attribute from undertow have the following effects:
This is not exactly the answer I was expecting, but I find it more acceptable than defining a custom property and making sure that property is on "instance-id".