Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-4637 - Allow unordered xml conf elements for clusters and bri… #4810

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 40 additions & 62 deletions artemis-server/src/main/resources/schema/artemis-configuration.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,37 @@
</xsd:annotation>
</xsd:element>

<xsd:element name="discovery-type" abstract="true"/>

<xsd:element name="static-connectors" substitutionGroup="discovery-type">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="allow-direct-connections-only" default="false" type="xsd:boolean" use="optional">
<xsd:annotation>
<xsd:documentation>
restricts a clusters connections to the listed connector-ref's
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>

<xsd:element name="discovery-group-ref" substitutionGroup="discovery-type">
<xsd:complexType>
<xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
<xsd:annotation>
<xsd:documentation>
name of the discovery group to use for this connection
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>

<!-- BROADCAST GROUP CONFIGURATION -->
<xsd:element name="broadcast-groups">
<xsd:annotation>
Expand Down Expand Up @@ -1222,13 +1253,6 @@
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>

<xsd:element name="discovery-group-ref">
<xsd:complexType>
<xsd:attribute name="discovery-group-name" type="xsd:IDREF"/>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>

<xsd:complexType name="class-name-sequenceType">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -1281,7 +1305,7 @@
</xsd:element>

<xsd:complexType name="bridgeType">
<xsd:sequence>
<xsd:all>
<xsd:element name="queue-name" type="xsd:string" maxOccurs="1" minOccurs="1">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -1469,29 +1493,9 @@
</xsd:annotation>
</xsd:element>

<xsd:choice>
<xsd:element name="static-connectors" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="1"/>
</xsd:sequence>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="discovery-group-ref" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
<xsd:annotation>
<xsd:documentation>
name of discovery group used by this bridge
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:sequence>
<xsd:element ref="discovery-type" maxOccurs="1" minOccurs="1"/>

</xsd:all>

<xsd:attribute name="name" type="xsd:ID" use="required">
<xsd:annotation>
Expand Down Expand Up @@ -2334,7 +2338,7 @@
</xsd:complexType>

<xsd:complexType name="cluster-connectionType">
<xsd:sequence>
<xsd:all>
<xsd:element name="address" type="xsd:string" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -2517,36 +2521,10 @@
</xsd:annotation>
</xsd:element>

<xsd:choice>
<xsd:element name="static-connectors" maxOccurs="1" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="allow-direct-connections-only" default="false" type="xsd:boolean" use="optional">
<xsd:annotation>
<xsd:documentation>
restricts cluster connections to the listed connector-ref's
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="discovery-group-ref" maxOccurs="1" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
<xsd:annotation>
<xsd:documentation>
name of discovery group used by this cluster-connection
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:sequence>
<xsd:element ref="discovery-type" maxOccurs="1" minOccurs="0"/>

</xsd:all>

<xsd:attribute name="name" type="xsd:ID" use="required">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,21 @@ public void testDefaultBridgeProducerWindowSize() throws Exception {
" <connector-ref>remote-connector</connector-ref>\n" +
" </static-connectors>\n" +
" </bridge>\n" +
" <bridge name=\"my-other-bridge\">\n" +
" <static-connectors>\n" +
" <connector-ref>remote-connector</connector-ref>\n" +
" </static-connectors>\n" +
" <forwarding-address>mincing-machine</forwarding-address>\n" +
" <queue-name>sausage-factory</queue-name>\n" +
" </bridge>\n" +
"</bridges>\n"
+ lastPart;
ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8));

Configuration config = parser.parseMainConfig(input);

List<BridgeConfiguration> bridgeConfigs = config.getBridgeConfigurations();
assertEquals(1, bridgeConfigs.size());
assertEquals(2, bridgeConfigs.size());

BridgeConfiguration bconfig = bridgeConfigs.get(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ public void testDefaults() {
Assert.assertEquals("connector2", ccc.getStaticConnectors().get(1));
Assert.assertEquals(null, ccc.getDiscoveryGroupName());
Assert.assertEquals(222, ccc.getProducerWindowSize());
Assert.assertEquals(true, ccc.isAllowDirectConnectionsOnly());
} else {
Assert.assertEquals("cluster-connection2", ccc.getName());
Assert.assertEquals("queues2", ccc.getAddress());
Expand All @@ -418,6 +419,7 @@ public void testDefaults() {
Assert.assertEquals(Collections.emptyList(), ccc.getStaticConnectors());
Assert.assertEquals("dg1", ccc.getDiscoveryGroupName());
Assert.assertEquals(333, ccc.getProducerWindowSize());
Assert.assertEquals(false, ccc.isAllowDirectConnectionsOnly());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@
<max-retry-interval>10002</max-retry-interval>
<reconnect-attempts>2</reconnect-attempts>
<failover-on-server-shutdown>false</failover-on-server-shutdown>
<use-duplicate-detection>true</use-duplicate-detection>
<confirmation-window-size>1G</confirmation-window-size>
<producer-window-size>444</producer-window-size>
<routing-type>STRIP</routing-type>
<static-connectors>
<connector-ref>connector1</connector-ref>
</static-connectors>
<use-duplicate-detection>true</use-duplicate-detection>
</bridge>
<bridge name="bridge2">
<queue-name>queue2</queue-name>
Expand All @@ -249,14 +249,14 @@
</bridge>
<bridge name="bridge3">
<queue-name>queue3</queue-name>
<forwarding-address>bridge-forwarding-address2</forwarding-address>
<transformer>
<class-name>org.foo.BridgeTransformer3</class-name>
<property key="bridgeTransformerKey1" value="bridgeTransformerValue1"/>
<property key="bridgeTransformerKey2" value="bridgeTransformerValue2"/>
</transformer>
<producer-window-size>555k</producer-window-size>
<discovery-group-ref discovery-group-name="dg1"/>
<forwarding-address>bridge-forwarding-address2</forwarding-address>
</bridge>
<bridge name="bridge4">
<queue-name>queue3</queue-name>
Expand Down Expand Up @@ -421,22 +421,22 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
<static-connectors>
<static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
</cluster-connection>
<cluster-connection name="cluster-connection2">
<discovery-group-ref discovery-group-name="dg1"/>
<address>queues2</address>
<connector-ref>connector2</connector-ref>
<call-timeout>456</call-timeout>
<call-failover-timeout>456</call-failover-timeout>
<retry-interval>4</retry-interval>
<use-duplicate-detection>false</use-duplicate-detection>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>2</max-hops>
<producer-window-size>333</producer-window-size>
<call-failover-timeout>456</call-failover-timeout>
<discovery-group-ref discovery-group-name="dg1"/>
</cluster-connection>
<cluster-connection name="cluster-connection3">
<connector-ref>connector2</connector-ref>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
<static-connectors>
<static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
<static-connectors>
<static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ under the License.

<bridges>
<bridge name="a">
<concurrency>2</concurrency>
<queue-name>a-from</queue-name>
<forwarding-address>a-new</forwarding-address>
<concurrency>2</concurrency>
<static-connectors>
<connector-ref>connector</connector-ref>
</static-connectors>
Expand Down
Loading