Permalink
Browse files

SWARM-587 Unable to connect to JMS remotely

MessagingFraction needs to provide a way to activate a RemoteConnectionFactory with HTTP connectors.
As well as the ability to create a topic or queue that will be exposed remotely through the java:/jboss/exported namespace
  • Loading branch information...
1 parent dcd49d1 commit f2d02dcda71a41362d44e2c94f57ffca732a093e @kenfinnigan kenfinnigan committed Aug 4, 2016
Showing with 45 additions and 0 deletions.
  1. +45 −0 messaging/src/main/java/org/wildfly/swarm/messaging/EnhancedServer.java
@@ -74,6 +74,15 @@ public EnhancedServer enableClustering() {
return this;
}
+ public EnhancedServer enableRemote() {
+ enableHTTPConnections();
+
+ connectionFactory(new ConnectionFactory("RemoteConnectionFactory")
+ .connectors(Collections.singletonList("http-connector"))
+ .entries("java:/RemoteConnectionFactory", "java:jboss/exported/jms/RemoteConnectionFactory"));
+ return this;
+ }
+
private EnhancedServer enableHTTPConnections() {
if (this.subresources().acceptor(("http-acceptor")) != null) {
return this;
@@ -99,6 +108,24 @@ public EnhancedServer jmsQueue(String childKey, JMSQueueConsumer config) {
});
}
+ public EnhancedServer remoteJmsQueue(String childKey) {
+ remoteJmsQueue(childKey, null);
+ return this;
+ }
+
+ @SuppressWarnings("unchecked")
+ public EnhancedServer remoteJmsQueue(String childKey, JMSQueueConsumer config) {
+ return super.jmsQueue(childKey, (q) -> {
+ if (config != null) {
+ config.accept(q);
+ }
+ if (q.entries() == null || q.entries().isEmpty()) {
+ q.entry("java:/jboss/exported/jms/queue/" + childKey);
+ q.entry("java:/jms/queue/" + childKey);
+ }
+ });
+ }
+
@SuppressWarnings("unchecked")
@Override
public EnhancedServer jmsTopic(String childKey, JMSTopicConsumer config) {
@@ -112,5 +139,23 @@ public EnhancedServer jmsTopic(String childKey, JMSTopicConsumer config) {
});
}
+ public EnhancedServer remoteJmsTopic(String childKey) {
+ remoteJmsTopic(childKey, null);
+ return this;
+ }
+
+ @SuppressWarnings("unchecked")
+ public EnhancedServer remoteJmsTopic(String childKey, JMSTopicConsumer config) {
+ return super.jmsTopic(childKey, (t) -> {
+ if (config != null) {
+ config.accept(t);
+ }
+ if (t.entries() == null || t.entries().isEmpty()) {
+ t.entry("java:/jboss/exported/jms/topic/" + childKey);
+ t.entry("java:/jms/topic/" + childKey);
+ }
+ });
+ }
+
private static final AtomicInteger COUNTER = new AtomicInteger();
}

0 comments on commit f2d02dc

Please sign in to comment.