Created
February 12, 2015 15:36
-
-
Save alphamikevictor/ac836f9f458bb7afe3e9 to your computer and use it in GitHub Desktop.
Jboss remoting cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6"> | |
| <display-name>frontend</display-name> | |
| <module> | |
| <web> | |
| <web-uri>clientApp.war</web-uri> | |
| <context-root>clientApp</context-root> | |
| </web> | |
| </module> | |
| </application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> | |
| <sub-deployment name="clientApp.war"> | |
| <dependencies> | |
| <module name="org.jboss.xnio" /> | |
| </dependencies> | |
| </sub-deployment> | |
| </jboss-deployment-structure> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <jboss-ejb-client xmlns:xsi="urn:jboss:ejb-client:1.2"> | |
| <client-context> | |
| <ejb-receivers> | |
| <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection1" /> | |
| <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection2" /> | |
| </ejb-receivers> | |
| <clusters> | |
| <cluster name="ejb" security-realm="ejb-security-realm" username="ejbuser"> | |
| <connection-creation-options> | |
| <property name="org.xnio.Options.SSL_ENABLED" value="false" /> | |
| <property name="org.xnio.Options.SASL_POLICY_NOANONYMOUS" | |
| value="false" /> | |
| </connection-creation-options> | |
| </cluster> | |
| </clusters> | |
| </client-context> | |
| </jboss-ejb-client> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.alosfogones.rest; | |
| import java.util.Hashtable; | |
| import javax.enterprise.context.RequestScoped; | |
| import javax.naming.Context; | |
| import javax.naming.InitialContext; | |
| import javax.ws.rs.GET; | |
| import javax.ws.rs.Path; | |
| import javax.ws.rs.PathParam; | |
| import javax.ws.rs.Produces; | |
| import javax.ws.rs.core.Response; | |
| import com.alosfogones.EJB.PropertyReaderRemote; | |
| import com.alosfogones.POJO.PropVal; | |
| @RequestScoped | |
| @Path("/propvals") | |
| public class ReadProperties { | |
| @GET | |
| @Path("/environment/{property}") | |
| @Produces("application/json") | |
| public Response getEnvProp(@PathParam("property") String property) { | |
| PropVal propval = new PropVal(); | |
| propval.setPropertyName(property); | |
| try{ | |
| //Hashtable<String,String> props = new Hashtable<String,String>(); | |
| //props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); | |
| final Context context = new InitialContext(); | |
| PropertyReaderRemote pr = (PropertyReaderRemote) context.lookup("ejb:backend/getProperties/PropertyReader!com.alosfogones.EJB.PropertyReaderRemote"); | |
| propval.setPropertyValue(pr.getEnvironmentProperty(property)); | |
| return Response.ok(propval).build(); | |
| } | |
| catch (Exception e){ | |
| e.printStackTrace(); | |
| propval.setPropertyValue("ERROR"); | |
| return Response.ok(propval).build(); | |
| } | |
| } | |
| @GET | |
| @Path("/java/{property}") | |
| @Produces("application/json") | |
| public Response getJavaProp(@PathParam("property") String property){ | |
| PropVal propval = new PropVal(); | |
| propval.setPropertyName(property); | |
| try{ | |
| //Hashtable<String,String> props = new Hashtable<String,String>(); | |
| //props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); | |
| final Context context = new InitialContext(); | |
| PropertyReaderRemote pr = (PropertyReaderRemote) context.lookup("ejb:backend/getProperties/PropertyReader!com.alosfogones.EJB.PropertyReaderRemote"); | |
| propval.setPropertyValue(pr.getJavaProperty(property)); | |
| return Response.ok(propval).build(); | |
| } | |
| catch (Exception e){ | |
| e.printStackTrace(); | |
| propval.setPropertyValue("ERROR"); | |
| return Response.ok(propval).build(); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <security-realm name="ejb-security-realm"> | |
| <server-identities> | |
| <secret value="TCVfcUt3Yk5pXzJPeEJvv2FOP1ZtMmxTUCUpWExKL0xtSEdZU3VlTClPVmVvWDlKT2EvQmlWTURmY2hSZVJRcAo="/> | |
| </server-identities> | |
| </security-realm> | |
| <outbound-connections> | |
| <remote-outbound-connection name="remote-ejb-connection1" outbound-socket-binding-ref="remote-ejb1" username="ejbuser" security-realm="ejb-security-realm"> | |
| <properties> | |
| <property name="SASL_POLICY_NOANONYMOUS" value="false"/> | |
| <property name="SSL_ENABLED" value="false"/> | |
| </properties> | |
| </remote-outbound-connection> | |
| <remote-outbound-connection name="remote-ejb-connection2" outbound-socket-binding-ref="remote-ejb2" username="ejbuser" security-realm="ejb-security-realm"> | |
| <properties> | |
| <property name="SASL_POLICY_NOANONYMOUS" value="false"/> | |
| <property name="SSL_ENABLED" value="false"/> | |
| </properties> | |
| </remote-outbound-connection> | |
| </outbound-connections> | |
| <outbound-socket-binding name="remote-ejb1"> | |
| <remote-destination host="backend-server-1" port="8011"/> | |
| </outbound-socket-binding> | |
| <outbound-socket-binding name="remote-ejb2"> | |
| <remote-destination host="backend-server-2" port="8011"/> | |
| </outbound-socket-binding> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment