-
-
Save tobias/d42f6133af1560318c4c to your computer and use it in GitHub Desktop.
This file contains 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
modified messaging/api/src/main/java/org/wildfly/swarm/messaging/MessagingFraction.java | |
@@ -32,11 +32,24 @@ public class MessagingFraction extends MessagingActiveMQ<MessagingFraction> impl | |
} | |
public MessagingFraction defaultServer() { | |
- if (this.defaultServer == null) { | |
- this.defaultServer = server("default", EnhancedServer::enableInVm); | |
+ if (getOrCreateDefaultServer() != null) { | |
+ server("default", EnhancedServer::enableInVm); | |
} | |
- return this.defaultServer; | |
+ return this; | |
+ } | |
+ | |
+ public MessagingFraction defaultServer(EnhancedServerConsumer config) { | |
+ config.accept(getOrCreateDefaultServer()); | |
+ | |
+ return this; | |
+ } | |
+ | |
+ private EnhancedServer getOrCreateDefaultServer() { | |
+ return (EnhancedServer)subresources().servers().stream() | |
+ .filter(s -> "default".equals(s.getKey())) | |
+ .findFirst() | |
+ .orElse(null); | |
} | |
public MessagingFraction server(String childKey, EnhancedServerConsumer consumer) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment