How to configure an MDB to read a queue on a remote Wildfly server.
kevinprendergast Mar 4, 2015 6:52 PMMy problem : I have a Queue defined in my 'QueueHost' machine's standalone-full as ...
<jms-queue name="testQueue">
<entry name="jms/queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
I can successfully connect to this queue from a .war inside the same QueueHost machine with a simple MDB.
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "jms/queue/test"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "user", propertyValue = "jms"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "password")
}, mappedName = "TestQueue")
public class TestMdb implements MessageListener {
private static final Logger log = LoggerFactory.getLogger(TestMdb.class);
public void onMessage(Message message) {
if (message instanceof TextMessage) {
TextMessage tm = (TextMessage) message;
try {
log.info("Text Message : " + tm.getText());
} catch (JMSException e) {
log.error(e.getLocalizedMessage());
}
}
}
}
I can successfully produce messages to the testQueue from a simple Java client, connecting to http-remoting://localhost:80
And these are happily consumed from the MDB. Awesome.
But then I attempt to move the .war to a second, remote Wildfly Server and I can not establish the remote connection.
Server 1 (QueueHost) : http is port 80.
Server 2 (QueueClient) : port binding is offset by +100, because it's actually in the same physical box as Server 1.
I've tested many permutations and interpretation of the manuals. With my 'best effort'...
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "jms/queue/test"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "user", propertyValue = "jms"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "password"),
@ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "java:jboss/exported/jms/RemoteConnectionFactory"),
@ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=http-remoting://localhost;port=80")
}, mappedName = "TestQueue")
...I'm getting this security exception.
HQ224018: Failed to create session: HornetQSecurityException[errorType=SECURITY_EXCEPTION message=HQ119031: Unable to validate user: jms]
...which leads me to conclude Server2 isn't going 'Remote' for the queue - it's just looking inside itself.
This is confirmed by changing to a user that only exists on Server2.
I'm doing this in Wildfly 8.2.0 Final, downloaded fresh the other day.
Both servers are running standalone-full, I have the vanilla definitions of ConnectionFactories etc.
Can somebody please help me here.
Many Thanks.
KP