Skip to content

Commit 1af323f

Browse files
author
Michiel Hendriks
committed
Exclude self from static cluster connectors
The static-connectors of a cluster should not contain this brokers' own connector as it will happily connect to itself and thus not properly participate in the cluster. Also added an option to configure allow-direct-connections-only and set it to false. This would allow a cluster to become dynamic using an initial static list.
1 parent 213248c commit 1af323f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

REFERENCE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ The following parameters are available in the `activemq::instance` defined type:
407407
* [`address_settings`](#-activemq--instance--address_settings)
408408
* [`addresses`](#-activemq--instance--addresses)
409409
* [`allow_failback`](#-activemq--instance--allow_failback)
410+
* [`allow_direct_connections_only`](#-activemq--instance--allow_direct_connections_only)
410411
* [`bind`](#-activemq--instance--bind)
411412
* [`broadcast_groups`](#-activemq--instance--broadcast_groups)
412413
* [`broker_plugins`](#-activemq--instance--broker_plugins)
@@ -478,6 +479,16 @@ Data type: `Boolean`
478479

479480
Should stop backup on live restart.
480481

482+
##### <a name="-activemq--instance--allow_direct_connections_only"></a>`allow_direct_connections_only`
483+
484+
Data type: `Optional[Boolean]`
485+
486+
When using `static` for [`server_discovery`](#-activemq--server_discovery)
487+
only make connections to the defined connectors and not any other
488+
broker in the cluser.
489+
490+
Default value: `true`
491+
481492
##### <a name="-activemq--instance--bind"></a>`bind`
482493

483494
Data type: `String`

manifests/instance.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# @param allow_failback
2121
# Should stop backup on live restart.
2222
#
23+
# @param allow_direct_connections_only
24+
# When using static server discovery only make connections to the
25+
# defined connectors and not any other broker in the cluser.
26+
#
2327
# @param bind
2428
# Configure which IP address to listen on. Should be either a FQDN
2529
# or an IP address.
@@ -167,6 +171,7 @@
167171
String $java_xms = $activemq::java_xms,
168172
String $java_xmx = $activemq::java_xmx,
169173
# Optional parameters
174+
Optional[Boolean] $allow_direct_connections_only = true,
170175
Optional[Integer] $global_max_size_mb = undef,
171176
Optional[String] $group = undef,
172177
Optional[Boolean] $service_enable = undef,
@@ -379,6 +384,7 @@
379384
'address_settings' => $address_settings,
380385
'addresses' => $addresses,
381386
'allow_failback' => $allow_failback,
387+
'allow_direct_connections_only' => $allow_direct_connections_only,
382388
'bind' => $bind,
383389
'broadcast_groups' => $broadcast_groups,
384390
'broker_plugins' => $_broker_plugins,

templates/broker.xml.epp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ under the License.
148148
<message-load-balancing><%= $message_load_balancing %></message-load-balancing>
149149
<max-hops><%= $max_hops %></max-hops>
150150
<% if $activemq::server_discovery == 'static' { -%>
151-
<static-connectors allow-direct-connections-only="true">
151+
<static-connectors allow-direct-connections-only="<%= $allow_direct_connections_only %>">
152152
<% $connectors.each |$key, $value| { -%>
153+
<%# # Do not add the connector that matches the name of this instance. -%>
154+
<% if ($key != "artemis-${name}") { -%>
153155
<connector-ref><%= $key %></connector-ref>
156+
<% } -%>
154157
<% } -%>
155158
</static-connectors>
156159
<% } -%>

0 commit comments

Comments
 (0)