<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2015, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="urn:jboss:domain:messaging-activemq:2.0"
           targetNamespace="urn:jboss:domain:messaging-activemq:2.0"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="2.0">

    <xs:element name="subsystem">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="1" minOccurs="0" name="global-client">
                    <xs:complexType>
                        <xs:attribute name="thread-pool-max-size" type="xs:int" />
                        <xs:attribute name="scheduled-thread-pool-max-size" type="xs:int" />
                    </xs:complexType>
                </xs:element>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="server" type="serverType" />
                <xs:element maxOccurs="unbounded" minOccurs="0" name="jms-bridge" type="jms-bridgeType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="serverType">
        <xs:sequence>

            <xs:element name="incoming-interceptors" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="class" type="classType" minOccurs="1" maxOccurs="unbounded" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:element name="outgoing-interceptors" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="class" type="classType" minOccurs="1" maxOccurs="unbounded" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <!-- server attribute groups -->
            <xs:element name="security" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="enabled" type="xs:boolean" />
                    <xs:attribute name="domain" type="xs:string" />
                    <xs:attribute name="elytron-domain" type="xs:string"/>
                    <xs:attribute name="invalidation-interval" type="xs:long" />
                    <xs:attribute name="override-in-vm-security" type="xs:boolean" />
                </xs:complexType>
            </xs:element>

            <xs:element name="cluster" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="credential-reference" type="credentialReferenceType" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                                <xs:documentation>
                                    Credential to be used by the configuration.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="user" type="xs:string" />
                    <xs:attribute name="password" type="xs:string" />
                </xs:complexType>
            </xs:element>

            <xs:element name="management" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="address" type="xs:string" />
                    <xs:attribute name="notification-address" type="xs:string" />
                    <xs:attribute name="jmx-enabled" type="xs:boolean" />
                    <xs:attribute name="jmx-domain" type="xs:string" />
                </xs:complexType>
            </xs:element>

            <xs:element name="journal" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="type">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="ASYNCIO"/>
                                <xs:enumeration value="NIO"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="buffer-timeout" type="xs:long" />
                    <xs:attribute name="buffer-size" type="xs:long" />
                    <xs:attribute name="sync-transactional" type="xs:boolean" />
                    <xs:attribute name="sync-non-transactional" type="xs:boolean" />
                    <xs:attribute name="log-write-rate" type="xs:boolean" />
                    <xs:attribute name="file-size" type="xs:long" />
                    <xs:attribute name="min-files" type="xs:int" />
                    <xs:attribute name="pool-files" type="xs:int" />
                    <xs:attribute name="compact-percentage" type="xs:int" />
                    <xs:attribute name="compact-min-files" type="xs:int" />
                    <xs:attribute name="max-io" type="xs:int" />
                    <xs:attribute name="create-bindings-dir" type="xs:boolean" />
                    <xs:attribute name="create-journal-dir" type="xs:boolean" />
                    <xs:attribute name="datasource" type="xs:string" />
                    <xs:attribute name="database" type="xs:string" />
                    <xs:attribute name="messages-table" type="xs:string" />
                    <xs:attribute name="bindings-table" type="xs:string" />
                    <xs:attribute name="jms-bindings-table" type="xs:string" />
                    <xs:attribute name="large-messages-table" type="xs:string" />
                    <xs:attribute name="page-store-table" type="xs:string" />
                    <xs:attribute name="jdbc-network-timeout" type="xs:int" />
                </xs:complexType>
            </xs:element>

            <xs:element name="statistics" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="enabled" type="xs:boolean" />
                    <xs:attribute name="message-counter-sample-period" type="xs:long" />
                    <xs:attribute name="message-counter-max-day-history" type="xs:int" />
                </xs:complexType>
            </xs:element>

            <xs:element name="transaction" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="timeout" type="xs:long" />
                    <xs:attribute name="scan-period" type="xs:long" />
                </xs:complexType>
            </xs:element>

            <xs:element name="message-expiry" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="scan-period" type="xs:long" />
                    <xs:attribute name="thread-priority" type="xs:int" />
                </xs:complexType>
            </xs:element>

            <xs:element name="debug" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="perf-blast-pages" type="xs:int" />
                    <xs:attribute name="run-sync-speed-test" type="xs:boolean" />
                    <xs:attribute name="server-dump-interval" type="xs:long" />
                    <xs:attribute name="memory-measure-interval" type="xs:long" />
                    <xs:attribute name="memory-warning-threshold" type="xs:int" />
                </xs:complexType>
            </xs:element>
            <!-- end of server attribute groups -->

            <xs:choice>
                <xs:element name="live-only" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="scale-down" minOccurs="0" maxOccurs="1" type="scale-downType" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="replication-master" minOccurs="0" maxOccurs="1" type="replication-masterType" />
                <xs:element name="replication-slave" minOccurs="0" maxOccurs="1" type="replication-slaveType" />
                <xs:element name="replication-colocated" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="master" minOccurs="0" maxOccurs="1" type="replication-masterType" />
                            <xs:element name="slave" minOccurs="0" maxOccurs="1" type="replication-slaveType" />
                        </xs:sequence>

                        <xs:attributeGroup ref="ha-policy-colocated-attributeGroup" />
                        <xs:attribute name="excluded-connectors" type="xs:string" use="optional" />
                    </xs:complexType>
                </xs:element>
                <xs:element name="shared-store-master" minOccurs="0" maxOccurs="1" type="shared-store-masterType" />
                <xs:element name="shared-store-slave" minOccurs="0" maxOccurs="1"  type="shared-store-slaveType" />
                <xs:element name="shared-store-colocated" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="master" minOccurs="0" maxOccurs="1" type="shared-store-masterType" />
                            <xs:element name="slave" minOccurs="0" maxOccurs="1" type="shared-store-slaveType" />
                        </xs:sequence>

                        <xs:attributeGroup ref="ha-policy-colocated-attributeGroup" />
                    </xs:complexType>
                </xs:element>
            </xs:choice>

            <xs:element name="bindings-directory" maxOccurs="1" minOccurs="0" type="directoryType" />
            <xs:element name="journal-directory" maxOccurs="1" minOccurs="0" type="directoryType" />
            <xs:element name="large-messages-directory" maxOccurs="1" minOccurs="0" type="directoryType" />
            <xs:element name="paging-directory" maxOccurs="1" minOccurs="0" type="directoryType" />

            <xs:element name="queue" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />

                    <xs:attribute name="address" type="xs:string" use="optional" />
                    <xs:attribute name="filter" type="xs:string" use="optional" />
                    <xs:attribute name="durable" type="xs:boolean" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="security-setting" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="role" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                                <xs:attribute name="name" type="xs:string" use="required" />

                                <xs:attribute name="send" type="xs:string" use="optional" />
                                <xs:attribute name="consume" type="xs:string" use="optional" />
                                <xs:attribute name="create-durable-queue" type="xs:string" use="optional" />
                                <xs:attribute name="delete-durable-queue" type="xs:string" use="optional" />
                                <xs:attribute name="create-non-durable-queue" type="xs:string" use="optional" />
                                <xs:attribute name="delete-non-durable-queue" type="xs:string" use="optional" />
                                <xs:attribute name="manage" type="xs:string" use="optional" />
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="address-setting" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />

                    <xs:attribute name="dead-letter-address" type="xs:string" use="optional" />
                    <xs:attribute name="expiry-address" type="xs:string" use="optional" />
                    <xs:attribute name="expiry-delay" type="xs:long" use="optional" />
                    <xs:attribute name="redelivery-delay" type="xs:long" use="optional" />
                    <xs:attribute name="redelivery-multiplier" type="xs:double" use="optional" />
                    <xs:attribute name="max-delivery-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="max-redelivery-delay" type="xs:long" use="optional" />
                    <xs:attribute name="max-size-bytes" type="xs:long" use="optional" />
                    <xs:attribute name="page-size-bytes" type="xs:long" use="optional" />
                    <xs:attribute name="page-max-cache-size" type="xs:int" use="optional" />
                    <xs:attribute name="address-full-policy" use="optional">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="DROP"/>
                                <xs:enumeration value="PAGE"/>
                                <xs:enumeration value="BLOCK"/>
                                <xs:enumeration value="FAIL"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="message-counter-history-day-limit" type="xs:int" use="optional" />
                    <xs:attribute name="last-value-queue" type="xs:boolean" use="optional" />
                    <xs:attribute name="redistribution-delay" type="xs:long" use="optional" />
                    <xs:attribute name="send-to-dla-on-no-route" type="xs:boolean" use="optional" />
                    <xs:attribute name="slow-consumer-check-period" type="xs:long" use="optional" />
                    <xs:attribute name="slow-consumer-policy" use="optional">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="KILL"/>
                                <xs:enumeration value="NOTIFY"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="slow-consumer-threshold" type="xs:long" use="optional" />
                    <xs:attribute name="auto-create-jms-queues" type="xs:boolean" use="optional" />
                    <xs:attribute name="auto-delete-jms-queues" type="xs:boolean" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="http-connector" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="socket-binding" type="xs:string" use="required" />
                    <xs:attribute name="endpoint" type="xs:string" use="required" />
                    <xs:attribute name="server-name" type="xs:string" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="remote-connector" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="socket-binding" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="in-vm-connector" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="server-id" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="connector" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="factory-class" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="http-acceptor" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="upgrade-legacy" type="xs:boolean" use="optional" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="http-listener" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="remote-acceptor" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="socket-binding" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="in-vm-acceptor" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="server-id" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="acceptor" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="factory-class" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="broadcast-group" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />

                    <xs:attribute name="socket-binding" type="xs:string" use="optional" />
                    <xs:attribute name="jgroups-stack" type="xs:string" use="optional" />
                    <xs:attribute name="jgroups-channel" type="xs:string" use="optional" />
                    <xs:attribute name="broadcast-period" type="xs:long" use="optional" />
                    <xs:attribute name="connectors" type="stringList" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="discovery-group" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />

                    <xs:attribute name="socket-binding" type="xs:string" use="optional" />
                    <xs:attribute name="jgroups-stack" type="xs:string" use="optional" />
                    <xs:attribute name="jgroups-channel" type="xs:string" use="optional" />
                    <xs:attribute name="refresh-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="initial-wait-timeout" type="xs:long" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="cluster-connection" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="address" type="xs:string" use="required" />
                    <xs:attribute name="connector-name" type="xs:string" use="required" />

                    <xs:attribute name="check-period" type="xs:long" use="optional" />
                    <xs:attribute name="connection-ttl" type="xs:long" use="optional" />
                    <xs:attribute name="min-large-message-size" type="xs:int" use="optional" />
                    <xs:attribute name="call-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="call-failover-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="retry-interval" type="xs:long" use="optional" />
                    <xs:attribute name="retry-interval-multiplier" type="xs:double" use="optional" />
                    <xs:attribute name="max-retry-interval" type="xs:long" use="optional" />
                    <xs:attribute name="initial-connect-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="reconnect-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="use-duplicate-detection" type="xs:boolean" use="optional" />
                    <xs:attribute name="message-load-balancing-type" use="optional">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="OFF"/>
                                <xs:enumeration value="STRICT"/>
                                <xs:enumeration value="ON_DEMAND"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="max-hops" type="xs:int" use="optional" />
                    <xs:attribute name="confirmation-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="producer-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="notification-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="notification-interval" type="xs:long" use="optional" />
                    <xs:attribute name="static-connectors" type="stringList" use="optional" />
                    <xs:attribute name="allow-direct-connections-only" type="xs:boolean" use="optional" />
                    <xs:attribute name="discovery-group" type="xs:string" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="grouping-handler" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="type" use="required">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="LOCAL"/>
                                <xs:enumeration value="REMOTE"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="address" type="xs:string" use="required" />

                    <xs:attribute name="timeout" type="xs:int" use="optional" />
                    <xs:attribute name="group-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="reaper-period" type="xs:long" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="divert" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="address" type="xs:string" use="required" />
                    <xs:attribute name="forwarding-address" type="xs:string" use="required" />

                    <xs:attribute name="routing-name" type="xs:string"  use="optional" />
                    <xs:attribute name="filter" type="xs:string" use="optional" />
                    <xs:attribute name="transformer-class-name" type="xs:string" use="optional" />
                    <xs:attribute name="exclusive" type="xs:boolean" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="bridge" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="credential-reference" type="credentialReferenceType" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                                <xs:documentation>
                                    Credential to be used by the configuration.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="queue-name" type="xs:string" use="required" />

                    <xs:attribute name="forwarding-address" type="xs:string" use="optional" />
                    <xs:attribute name="ha" type="xs:boolean"  use="optional" />
                    <xs:attribute name="filter" type="xs:string"  use="optional" />
                    <xs:attribute name="transformer-class-name" type="xs:string"  use="optional" />
                    <xs:attribute name="min-large-message-size" type="xs:int" use="optional" />
                    <xs:attribute name="check-period" type="xs:long"  use="optional" />
                    <xs:attribute name="connection-ttl" type="xs:long"  use="optional" />
                    <xs:attribute name="retry-interval" type="xs:long"  use="optional" />
                    <xs:attribute name="retry-interval-multiplier" type="xs:double"  use="optional" />
                    <xs:attribute name="max-retry-interval" type="xs:long"  use="optional" />
                    <xs:attribute name="reconnect-attempts" type="xs:int"  use="optional" />
                    <xs:attribute name="reconnect-attempts-on-same-node" type="xs:int"  use="optional" />
                    <xs:attribute name="use-duplicate-detection" type="xs:boolean"  use="optional" />
                    <xs:attribute name="confirmation-window-size" type="xs:int"  use="optional" />
                    <xs:attribute name="producer-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="user" type="xs:string"  use="optional" />
                    <xs:attribute name="password" type="xs:string"  use="optional" />
                    <xs:attribute name="static-connectors" type="stringList"  use="optional" />
                    <xs:attribute name="discovery-group" type="xs:string"  use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="connector-service" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="paramType" />
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="factory-class" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>

            <xs:element name="jms-queue" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="entries" type="stringList" use="required" />

                    <xs:attribute name="selector" type="xs:string" use="optional" />
                    <xs:attribute name="durable" type="xs:string" use="optional" />
                    <xs:attribute name="legacy-entries" type="stringList" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="jms-topic" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="entries" type="stringList" use="required" />
                    <xs:attribute name="legacy-entries" type="stringList" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="connection-factory" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="entries" type="stringList" use="required" />

                    <xs:attributeGroup ref="common-connection-factory-attributeGroup" />
                    <xs:attribute name="factory-type" type="connectionFactoryType" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="legacy-connection-factory" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="entries" type="stringList" use="required" />

                    <xs:attribute name="discovery-group" type="xs:string" use="optional" />
                    <xs:attribute name="connectors" type="stringList" use="optional" />

                    <xs:attribute name="auto-group" type="xs:boolean" use="optional" />
                    <xs:attribute name="block-on-acknowledge" type="xs:boolean" use="optional" />
                    <xs:attribute name="block-on-durable-send" type="xs:boolean" use="optional" />
                    <xs:attribute name="block-on-non-durable-send" type="xs:boolean" use="optional" />
                    <xs:attribute name="call-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="call-failover-timeout" type="xs:long" use="optional" />
                    <xs:attribute name="cache-large-message-client" type="xs:boolean" use="optional" />
                    <xs:attribute name="client-failure-check-period" type="xs:long" use="optional" />
                    <xs:attribute name="client-id" type="xs:string" use="optional" />
                    <xs:attribute name="compress-large-messages" type="xs:boolean" use="optional" />
                    <xs:attribute name="confirmation-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="connection-load-balancing-policy-class-name" type="xs:string" use="optional" />
                    <xs:attribute name="connection-ttl" type="xs:long" use="optional" />
                    <xs:attribute name="consumer-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="consumer-max-rate" type="xs:int" use="optional" />
                    <xs:attribute name="dups-ok-batch-size" type="xs:int" use="optional" />
                    <xs:attribute name="factory-type" type="connectionFactoryType" use="optional" />
                    <xs:attribute name="failover-on-initial-connection" type="xs:boolean" use="optional" />
                    <xs:attribute name="group-id" type="xs:string" use="optional" />
                    <xs:attribute name="initial-connect-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="initial-message-packet-size" type="xs:int" use="optional" />
                    <xs:attribute name="ha" type="xs:boolean" use="optional" />
                    <xs:attribute name="max-retry-interval" type="xs:long" use="optional" />
                    <xs:attribute name="min-large-message-size" type="xs:int" use="optional" />
                    <xs:attribute name="pre-acknowledge" type="xs:boolean" use="optional" />
                    <xs:attribute name="producer-max-rate" type="xs:int" use="optional" />
                    <xs:attribute name="producer-window-size" type="xs:int" use="optional" />
                    <xs:attribute name="reconnect-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="retry-interval" type="xs:long" use="optional" />
                    <xs:attribute name="retry-interval-multiplier" type="xs:double" use="optional" />
                    <xs:attribute name="scheduled-thread-pool-max-size" type="xs:int" use="optional" />
                    <xs:attribute name="thread-pool-max-size" type="xs:int" use="optional" />
                    <xs:attribute name="transaction-batch-size" type="xs:int" use="optional" />
                    <xs:attribute name="use-global-pools" type="xs:boolean" use="optional" />
                </xs:complexType>
            </xs:element>

            <xs:element name="pooled-connection-factory" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="inbound-config" minOccurs="0" maxOccurs="1">
                            <xs:complexType>
                                <xs:attribute name="use-jndi" type="xs:boolean" use="optional" />
                                <xs:attribute name="jndi-params" type="xs:string" use="optional" />
                                <xs:attribute name="rebalance-connections" type="xs:boolean" use="optional" />
                                <xs:attribute name="use-local-tx" type="xs:boolean" use="optional" />
                                <xs:attribute name="setup-attempts" type="xs:int" use="optional" />
                                <xs:attribute name="setup-interval" type="xs:long" use="optional" />
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="outbound-config" minOccurs="0" maxOccurs="1">
                            <xs:complexType>
                                <xs:attribute name="allow-local-transactions" type="xs:boolean" use="optional" />
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="credential-reference" type="credentialReferenceType" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                                <xs:documentation>
                                    Credential to be used by the configuration.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="entries" type="stringList" use="required" />

                    <xs:attributeGroup ref="common-connection-factory-attributeGroup" />
                    <xs:attribute name="transaction" use="optional">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="xa"/>
                                <xs:enumeration value="local"/>
                                <xs:enumeration value="none"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="user" type="xs:string" use="optional" />
                    <xs:attribute name="password" type="xs:string" use="optional" />
                    <xs:attribute name="min-pool-size" type="xs:int" use="optional" />
                    <xs:attribute name="use-auto-recovery" type="xs:boolean" use="optional" />
                    <xs:attribute name="max-pool-size" type="xs:int" use="optional" />
                    <xs:attribute name="managed-connection-pool" type="xs:string" use="optional" />
                    <xs:attribute name="enlistment-trace" type="xs:boolean" use="optional" />
                    <xs:attribute name="initial-message-packet-size" type="xs:int" use="optional" />
                    <xs:attribute name="initial-connect-attempts" type="xs:int" use="optional" />
                    <xs:attribute name="statistics-enabled" type="xs:boolean" use="optional" />
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attribute name="name" type="xs:string" use="required" />

        <xs:attribute name="persistence-enabled" type="xs:boolean" use="optional" />
        <xs:attribute name="persist-id-cache" type="xs:boolean" use="optional" />
        <xs:attribute name="persist-delivery-count-before-delivery" type="xs:boolean" use="optional" />
        <xs:attribute name="id-cache-size" type="xs:int" use="optional" />
        <xs:attribute name="page-max-concurrent-io" type="xs:int" use="optional" />
        <xs:attribute name="scheduled-thread-pool-max-size" type="xs:int" use="optional" />
        <xs:attribute name="thread-pool-max-size" type="xs:int" use="optional" />
        <xs:attribute name="wild-card-routing-enabled" type="xs:boolean" use="optional" />
        <xs:attribute name="connection-ttl-override" type="xs:long" use="optional" />
        <xs:attribute name="async-connection-execution-enabled" type="xs:boolean" use="optional" />
    </xs:complexType>

    <xs:simpleType name="stringList">
        <xs:restriction base="xs:string">
            <xs:annotation>
                <xs:documentation>
                    <![CDATA[ A list of string separated by whitespaces. ]]>
                </xs:documentation>
            </xs:annotation>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="classType">
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="module" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="scale-downType">
        <xs:attribute name="enabled" type="xs:boolean" use="required" />
        <xs:attribute name="cluster-name" type="xs:string" use="required" />
        <xs:attribute name="group-name" type="xs:string" use="optional" />
        <xs:attribute name="discovery-group" type="xs:string" use="optional" />
        <xs:attribute name="connectors" type="xs:string" use="optional" />
    </xs:complexType>

    <xs:complexType name="replication-masterType">
        <xs:attribute name="cluster-name" type="xs:string" use="optional" />
        <xs:attribute name="group-name" type="xs:string" use="optional" />
        <xs:attribute name="check-for-live-server" type="xs:boolean" use="optional" />
        <xs:attribute name="initial-replication-sync-timeout" type="xs:long" use="optional" />
    </xs:complexType>

    <xs:complexType name="replication-slaveType">
        <xs:sequence>
            <xs:element name="scale-down" minOccurs="0" maxOccurs="1" type="scale-downType" />
        </xs:sequence>

        <xs:attribute name="cluster-name" type="xs:string" use="optional" />
        <xs:attribute name="group-name" type="xs:string" use="optional" />
        <xs:attribute name="allow-failback" type="xs:boolean" use="optional" />
        <xs:attribute name="initial-replication-sync-timeout" type="xs:long" use="optional" />
        <xs:attribute name="restart-backup" type="xs:boolean" use="optional" />
        <xs:attribute name="max-saved-replicated-journal-size" type="xs:int" use="optional" />
    </xs:complexType>

    <xs:complexType name="shared-store-masterType">
        <xs:attribute name="failover-on-server-shutdown" type="xs:boolean" use="optional" />
    </xs:complexType>

    <xs:complexType name="shared-store-slaveType">
        <xs:sequence>
            <xs:element name="scale-down" minOccurs="0" maxOccurs="1" type="scale-downType" />
        </xs:sequence>

        <xs:attribute name="allow-failback" type="xs:boolean" use="optional" />
        <xs:attribute name="failover-on-server-shutdown" type="xs:boolean" use="optional" />
        <xs:attribute name="restart-backup" type="xs:boolean" use="optional" />
    </xs:complexType>

    <xs:attributeGroup name="ha-policy-colocated-attributeGroup">
        <xs:attribute name="request-backup" type="xs:boolean" use="optional" />
        <xs:attribute name="backup-request-retries" type="xs:int" use="optional" />
        <xs:attribute name="backup-request-retry-interval" type="xs:long" use="optional" />
        <xs:attribute name="max-backups" type="xs:int" use="optional" />
        <xs:attribute name="backup-port-offset" type="xs:int" use="optional" />
    </xs:attributeGroup>

    <xs:complexType name="directoryType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                A directory location configuration.

                The "path" attribute denotes a relative or absolute filesystem pathname where the directory should be
                located.

                The "relative-to" attribute references a global path configuration in the domain model, defaulting
                to the JBoss Application Server data directory (jboss.server.data.dir). If the value of the "path" attribute
                does not specify an absolute pathname, it will treated as relative to this path.
            ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="path" type="xs:string" />
        <xs:attribute name="relative-to" type="xs:string" default="jboss.server.data.dir" />
    </xs:complexType>

    <xs:complexType name="paramType">
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="value" type="xs:string" use="required" />
    </xs:complexType>

    <xs:attributeGroup name="common-connection-factory-attributeGroup">
        <xs:attribute name="discovery-group" type="xs:string" use="optional" />
        <xs:attribute name="connectors" type="xs:string" use="optional" />
        <xs:attribute name="ha" type="xs:boolean" use="optional" />
        <xs:attribute name="client-failure-check-period" type="xs:long" use="optional" />
        <xs:attribute name="connection-ttl" type="xs:long" use="optional" />
        <xs:attribute name="call-timeout" type="xs:long" use="optional" />
        <xs:attribute name="call-failover-timeout" type="xs:long" use="optional" />
        <xs:attribute name="consumer-window-size" type="xs:int" use="optional" />
        <xs:attribute name="consumer-max-rate" type="xs:int" use="optional" />
        <xs:attribute name="confirmation-window-size" type="xs:int" use="optional" />
        <xs:attribute name="producer-window-size" type="xs:int" use="optional" />
        <xs:attribute name="producer-max-rate" type="xs:int" use="optional" />
        <xs:attribute name="protocol-manager-factory" type="xs:string" use="optional" />
        <xs:attribute name="compress-large-messages" type="xs:boolean" use="optional" />
        <xs:attribute name="cache-large-message-client" type="xs:boolean" use="optional" />
        <xs:attribute name="min-large-message-size" type="xs:int" use="optional" />
        <xs:attribute name="client-id" type="xs:string" use="optional" />
        <xs:attribute name="dups-ok-batch-size" type="xs:int" use="optional" />
        <xs:attribute name="transaction-batch-size" type="xs:int" use="optional" />
        <xs:attribute name="block-on-acknowledge" type="xs:boolean" use="optional" />
        <xs:attribute name="block-on-non-durable-send" type="xs:boolean" use="optional" />
        <xs:attribute name="block-on-durable-send" type="xs:boolean" use="optional" />
        <xs:attribute name="auto-group" type="xs:boolean" use="optional" />
        <xs:attribute name="pre-acknowledge" type="xs:boolean" use="optional" />
        <xs:attribute name="retry-interval" type="xs:long" use="optional" />
        <xs:attribute name="retry-interval-multiplier" type="xs:double" use="optional" />
        <xs:attribute name="max-retry-interval" type="xs:long" use="optional" />
        <xs:attribute name="reconnect-attempts" type="xs:int" use="optional" />
        <xs:attribute name="failover-on-initial-connection" type="xs:boolean" use="optional" />
        <xs:attribute name="connection-load-balancing-policy-class-name" type="xs:string" use="optional" />
        <xs:attribute name="use-global-pools" type="xs:boolean" use="optional" />
        <xs:attribute name="scheduled-thread-pool-max-size" type="xs:int" use="optional" />
        <xs:attribute name="thread-pool-max-size" type="xs:int" use="optional" />
        <xs:attribute name="group-id" type="xs:string" use="optional" />
        <xs:attribute name="deserialization-white-list" type="stringList" use="optional" />
        <xs:attribute name="deserialization-black-list" type="stringList" use="optional" />
    </xs:attributeGroup>

    <xs:simpleType name="connectionFactoryType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="GENERIC"/>
            <xs:enumeration value="TOPIC"/>
            <xs:enumeration value="QUEUE"/>
            <xs:enumeration value="XA_GENERIC"/>
            <xs:enumeration value="XA_QUEUE"/>
            <xs:enumeration value="XA_TOPIC"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="jms-bridgeType">
        <xs:sequence>
            <xs:element name="source" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="source-context" type="contextType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="source-credential-reference" type="credentialReferenceType" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                                <xs:documentation>
                                    Credential to be used by the configuration to connect to the source destination.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="connection-factory" type="xs:string" use="required" />
                    <xs:attribute name="destination" type="xs:string" use="required" />
                    <xs:attribute name="user" type="xs:string" use="optional" />
                    <xs:attribute name="password" type="xs:string" use="optional" />
                </xs:complexType>
            </xs:element>
            <xs:element name="target" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="target-context" type="contextType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="target-credential-reference" type="credentialReferenceType" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                                <xs:documentation>
                                    Credential to be used by the configuration to connect to the target destination.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="connection-factory" type="xs:string" use="required" />
                    <xs:attribute name="destination" type="xs:string" use="required" />
                    <xs:attribute name="user" type="xs:string" use="optional" />
                    <xs:attribute name="password" type="xs:string" use="optional" />
                </xs:complexType>
            </xs:element>
        </xs:sequence>

        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="module" type="xs:string" use="required" />

        <xs:attribute name="quality-of-service" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="AT_MOST_ONCE"/>
                    <xs:enumeration value="DUPLICATES_OK"/>
                    <xs:enumeration value="ONCE_AND_ONLY_ONCE"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="failure-retry-interval" type="xs:long" use="required" />
        <xs:attribute name="max-retries" type="xs:int" use="required" />
        <xs:attribute name="max-batch-size" type="xs:int" use="required" />
        <xs:attribute name="max-batch-time" type="xs:long" use="required" />
        <xs:attribute name="selector" type="xs:string" use="optional" />
        <xs:attribute name="subscription-name" type="xs:string" use="optional" />
        <xs:attribute name="client-id" type="xs:string" use="optional" />
        <xs:attribute name="add-messageID-in-header" type="xs:boolean" use="optional" />
    </xs:complexType>

    <xs:complexType name="contextType">
        <xs:sequence>
            <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required" />
                    <xs:attribute name="value" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <!-- Credential Reference Types -->
    <xs:attributeGroup name="credentialReferenceStoreBased">
        <xs:annotation>
            <xs:documentation>
                Group of attributes used when referencing credential through credential store.
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="store" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Credential store name used to fetch credential with given 'alias' from.
                    Credential store name has to be defined elsewhere.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="alias" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Alias of credential in the credential store.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Type of credential to be fetched from credential store.
                    It is usually fully qualified class name.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>

    <xs:complexType name="credentialReferenceType">
        <xs:attributeGroup ref="credentialReferenceStoreBased"/>
        <xs:attribute name="clear-text" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Credential/password in clear text. Use just for testing purpose.
                    Otherwise use credential store to mask the actual credential from your configuration.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

</xs:schema>
