Remote clients
Topics and queues can be used remotely. A remote client must use JNDI to get the default JMS connection factory. Here's the code to obtain the connection factory:
String CONNECTION_FACTORY = "jms/RemoteConnectionFactory"; ... final Properties env = new Properties(); env.put(INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(PROVIDER_URL, "http-remoting://127.0.0.1:8080"); Context namingContext = new InitialContext(env); ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(CONNECTION_FACTORY);
The remote connection factory is declared in the standalone-full.xml
property file in the standalone/configuration
folder of WildFly:
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
The connectors field lets the connection factory be called with JNDI through the http-remoting
protocol. This protocol was created since the JBoss 5...