-
1. Re: wildfly8-CR1: How to configure http/servlet transport with HornetQ and how to set client's context properties?
jmesnil Jan 2, 2014 11:54 AM (in response to ybxiang.china)The http-connector has been introduced in WildFly 8.0.0.CR1 to upgrade from a HTTP request to HornetQ own JMS binary protocol.
By default, the standalone-full.xml configuration is shipped with a JMS ConnectionFactory that uses such a http-connector.
The client code is simply using the http-remoting://localhost:8080 URL to connect to the JNDI provider and lookup the /jms/HTTPConnectionFactory connection factory:
InitialContext initialContext = null;
try
{
// Step 1. Create an initial context to perform the JNDI lookup.
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
env.put(Context.SECURITY_PRINCIPAL, "guest");
env.put(Context.SECURITY_CREDENTIALS, "password");
initialContext = new InitialContext(env);
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/jms/HTTPConnectionFactory");
try (JMSContext context = cf.createContext("guest", "password")) {
TemporaryQueue tempQueue = context.createTemporaryQueue();
context.createProducer().send(tempQueue, "hello");
JMSConsumer consumer = context.createConsumer(tempQueue);
String response = consumer.receiveBody(String.class, 2000);
System.out.println("response = " + response);
}
} finally {
if (initialContext != null)
{
initialContext.close();
}
}
-
2. Re: wildfly8-CR1: How to configure http/servlet transport with HornetQ and how to set client's context properties?
ybxiang.china Jan 2, 2014 7:38 PM (in response to jmesnil)Your explanation is very clear!
The demo code is what I want!
Thank you VERY much! You are good man!
-
3. Re: wildfly8-CR1: How to configure http/servlet transport with HornetQ and how to set client's context properties?
ybxiang.china Jan 5, 2014 10:05 PM (in response to jmesnil)Dear Jeff Mesnil,
Have you tried to set security domain for <subsystem xmlns="urn:jboss:domain:messaging:2.0"> in wildfly8???
I can not make it work, and posted the question here: Security domain does NOT work for <subsystem xmlns="urn:jboss:domain:messaging:2.0">!!!.
I spent several days on reading many articles (mainly from jboss.org and stackoverflow.com), it seems only you know the answer.
Would you please help me?
Any tip is highly appreciated!
-
4. Re: wildfly8-CR1: How to configure http/servlet transport with HornetQ and how to set client's context properties?
ybxiang.china Jan 6, 2014 1:49 AM (in response to ybxiang.china)Solved:
add one line in env:
env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
Detail: Security domain does NOT work for <subsystem xmlns="urn:jboss:domain:messaging:2.0">!!!