[ 
https://issues.apache.org/jira/browse/ARTEMIS-4629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17813743#comment-17813743
 ] 

Justin Bertram commented on ARTEMIS-4629:
-----------------------------------------

The XSD definition for {{bridge}} uses {{<xsd:sequence>}} so the order of the 
elements really matters. If the order is wrong then validation will fail, as 
you've seen. Your non-working examples will work with a little adjustment.

Here's  [^non_working_example3.xml]:
{code:xml}
    <connectors>
        <connector 
name="server1-connector">tcp://server1:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
        <connector 
name="server2-connector">tcp://server2:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
    </connectors>

    <bridges>
        <bridge name="test-bridge">
            <queue-name>TEST.Q</queue-name>
            <forwarding-address>TEST.RECEIVER.Q</forwarding-address>
            <user>username</user>
            <password>password</password>
            <routing-type>STRIP</routing-type>
            <concurrency>1</concurrency>
            <retry-interval>1000</retry-interval>
            <retry-interval-multiplier>1.0</retry-interval-multiplier>
            <initial-connect-attempts>-1</initial-connect-attempts>
            <reconnect-attempts>-1</reconnect-attempts>
            <failover-on-server-shutdown>true</failover-on-server-shutdown>
            <use-duplicate-detection>true</use-duplicate-detection>
            <confirmation-window-size>10000000</confirmation-window-size>
            <producer-window-size>10000000</producer-window-size>
            <static-connectors>
                <connector-ref>server1-connector</connector-ref>
                <connector-ref>server1-connector</connector-ref>
            </static-connectors>
        </bridge>
    <bridges>{code}
First, this fails because you don't properly close {{<bridges>}}, but even once 
that is fixed validation fails because the order is wrong. You should use this 
instead:
{code:xml}
    <connectors>
        <connector 
name="server1-connector">tcp://server1:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
        <connector 
name="server2-connector">tcp://server2:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
    </connectors>

    <bridges>
        <bridge name="test-bridge">
            <queue-name>TEST.Q</queue-name>
            <forwarding-address>TEST.RECEIVER.Q</forwarding-address>
            <retry-interval>1000</retry-interval>
            <retry-interval-multiplier>1.0</retry-interval-multiplier>
            <initial-connect-attempts>-1</initial-connect-attempts>
            <reconnect-attempts>-1</reconnect-attempts>
            <failover-on-server-shutdown>true</failover-on-server-shutdown>
            <use-duplicate-detection>true</use-duplicate-detection>
            <confirmation-window-size>10000000</confirmation-window-size>
            <producer-window-size>10000000</producer-window-size>
            <user>username</user>
            <password>password</password>
            <routing-type>STRIP</routing-type>
            <concurrency>1</concurrency>
            <static-connectors>
                <connector-ref>server1-connector</connector-ref>
                <connector-ref>server1-connector</connector-ref>
            </static-connectors>
        </bridge>
    </bridges>{code}
Here's  [^non_working_example4.xml] :
{code:xml}
    <connectors>
        <connector 
name="server1-connector">tcp://server1:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
        <connector 
name="server2-connector">tcp://server2:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
    </connectors>

    <bridges>
        <bridge name="test-bridge">
            <queue-name>TEST.Q</queue-name>
            <forwarding-address>TEST.RECEIVER.Q</forwarding-address>
            <user>username</user>
            <password>password</password>
            <routing-type>STRIP</routing-type>
            <ha>true</ha>
            <concurrency>1</concurrency>
            <retry-interval>1000</retry-interval>
            <retry-interval-multiplier>1.0</retry-interval-multiplier>
            <initial-connect-attempts>-1</initial-connect-attempts>
            <reconnect-attempts>-1</reconnect-attempts>
            <failover-on-server-shutdown>true</failover-on-server-shutdown>
            <use-duplicate-detection>true</use-duplicate-detection>
            <confirmation-window-size>10000000</confirmation-window-size>
            <producer-window-size>10000000</producer-window-size>
            <static-connectors>
                <connector-ref>server1-connector</connector-ref>
                <connector-ref>server1-connector</connector-ref>
            </static-connectors>
        </bridge>
    <bridges>{code}
This again fails because you don't close {{<bridges>}} properly and after 
that's fixed validation still fails due to the wrong order. Use this instead:
{code:xml}
    <connectors>
        <connector 
name="server1-connector">tcp://server1:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
        <connector 
name="server2-connector">tcp://server2:61616?minLargeMessageSize=1024000;call-timeout=30000</connector>
    </connectors>

    <bridges>
        <bridge name="test-bridge">
            <queue-name>TEST.Q</queue-name>
            <forwarding-address>TEST.RECEIVER.Q</forwarding-address>
            <ha>true</ha>
            <retry-interval>1000</retry-interval>
            <retry-interval-multiplier>1.0</retry-interval-multiplier>
            <initial-connect-attempts>-1</initial-connect-attempts>
            <reconnect-attempts>-1</reconnect-attempts>
            <failover-on-server-shutdown>true</failover-on-server-shutdown>
            <use-duplicate-detection>true</use-duplicate-detection>
            <confirmation-window-size>10000000</confirmation-window-size>
            <producer-window-size>10000000</producer-window-size>
            <user>username</user>
            <password>password</password>
            <routing-type>STRIP</routing-type>
            <concurrency>1</concurrency>
            <static-connectors>
                <connector-ref>server1-connector</connector-ref>
                <connector-ref>server1-connector</connector-ref>
            </static-connectors>
        </bridge>
    </bridges>{code}

> Core bridge configuration validation errors
> -------------------------------------------
>
>                 Key: ARTEMIS-4629
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4629
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.32.0
>         Environment: ActiveMQ Artemis 2.32.0, 2.31.2
> Operating systems: Windows, Linux
>            Reporter: Aleksandr Milovidov
>            Priority: Minor
>         Attachments: example_validation_errors.log, non_working_example3.xml, 
> non_working_example4.xml, working_example1.xml, working_example2.xml
>
>
> When I tried to configure Core Bridge to transfer messages from one Artemis 
> broker to another clustered Artemis broker, I have encountered several 
> validation errors. I tried to insert ha option in different positions in the 
> bridge section and got different validation errors. It seems that order of 
> parameters in the bridge section does matter and it is impossible to combine 
> ha options with reconnect parameters.
> Attached examples of working and non-working bridge configurations (it needs 
> to be added to default broker.xml).
> Example core bridge configuration from documentation also does not work.
> There are also undocumented parameters which are mentioned in error log 
> message, for example "reconnect-attempts-same-node". It is documented only in 
> configuration index (does not exists in 
> [https://activemq.apache.org/components/artemis/documentation/latest/core-bridges.html]).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to