<schema package="qpid">

<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->

  <!-- Type information:

       Numeric types with "_wm" suffix are watermarked numbers.  These are compound
       values containing a current value, and a low and high water mark for the reporting
       interval.  The low and high water marks are set to the current value at the
       beginning of each interval and track the minimum and maximum values of the statistic
       over the interval respectively.

       Access rights for configuration elements:

           RO => Read Only
           RC => Read/Create, can be set at create time only, read-only thereafter
           RW => Read/Write

           If access rights are omitted for a property, they are assumed to be RO.

  -->

  <!-- Questions:  Does C++ broker round-robin dests on queues? -->

  <!--
  ===============================================================
  System
  ===============================================================
  -->
  <class name="System">
    <property name="systemId" index="y" type="uuid" access="RC"/>

    <property name="osName"   type="sstr" access="RO" desc="Operating System Name"/>
    <property name="nodeName" type="sstr" access="RO" desc="Node Name"/>
    <property name="release"  type="sstr" access="RO"/>
    <property name="version"  type="sstr" access="RO"/>
    <property name="machine"  type="sstr" access="RO"/>

  </class>

  <!--
  ===============================================================
  Broker
  ===============================================================
  -->
  <class name="Broker">
    <property name="systemRef"            type="objId"  references="System" access="RC" index="y" desc="System ID" parentRef="y"/>
    <property name="port"                 type="uint16" access="RC" index="y" desc="TCP Port for AMQP Service"/>
    <property name="workerThreads"        type="uint16" access="RO" desc="Thread pool size"/>
    <property name="maxConns"             type="uint16" access="RO" desc="Maximum allowed connections"/>
    <property name="connBacklog"          type="uint16" access="RO" desc="Connection backlog limit for listening socket"/>
    <property name="stagingThreshold"     type="uint32" access="RO" desc="Broker stages messages over this size to disk"/>
    <property name="mgmtPubInterval"      type="uint16" access="RW" unit="second" min="1" desc="Interval for management broadcasts"/>
    <property name="clusterName"          type="sstr"   access="RO"
                   desc="Name of cluster this server is a member of"/>
    <property name="version"              type="sstr"   access="RO" desc="Running software version"/>
    <property name="dataDirEnabled"       type="bool"   access="RO" desc="Persistent configuration storage enabled"/>
    <property name="dataDir"              type="sstr"   access="RO" desc="Persistent configuration storage location"/>

    <method name="joinCluster">
      <arg name="clusterName" dir="I" type="sstr"/>
    </method>

    <method name="leaveCluster"/>

    <method name="echo" desc="Request a response to test the path to the management broker">
      <arg name="sequence" dir="IO" type="uint32" default="0"/>
      <arg name="body"     dir="IO" type="lstr"   default=""/>
    </method>

    <method name="connect" desc="Establish a connection to another broker">
      <arg name="host"          dir="I" type="sstr"/>
      <arg name="port"          dir="I" type="uint32"/>
      <arg name="useSsl"        dir="I" type="bool"/>
      <arg name="durable"       dir="I" type="bool"/>
      <arg name="authMechanism" dir="I" type="sstr"/>
      <arg name="username"      dir="I" type="sstr"/>
      <arg name="password"      dir="I" type="sstr"/>
    </method>
  </class>

  <!--
  ===============================================================
  Management Agent
  ===============================================================
  -->
  <class name="Agent">
    <property name="connectionRef" type="objId"  references="Connection" access="RO" index="y"/>
    <property name="label"         type="sstr"   access="RO"           desc="Label for agent"/>
    <property name="registeredTo"  type="objId"  references="Broker" access="RO" desc="Broker agent is registered to"/>
    <property name="systemId"      type="uuid"   access="RO"           desc="Identifier of system where agent resides"/>
    <property name="objectIdBank"  type="uint32" access="RO"           desc="Assigned object-id bank"/>
  </class>

  <!--
  ===============================================================
  Virtual Host
  ===============================================================
  -->
  <class name="Vhost">
    <property name="brokerRef" type="objId" references="Broker" access="RC" index="y" parentRef="y"/>
    <property name="name"      type="sstr"  access="RC" index="y"/>
  </class>

  <!--
  ===============================================================
  Queue
  ===============================================================
  -->
  <class name="Queue">
    <property name="vhostRef"   type="objId" references="Vhost" access="RC" index="y" parentRef="y"/>
    <property name="name"       type="sstr"  access="RC" index="y"/>

    <property name="durable"    type="bool"  access="RC"/>
    <property name="autoDelete" type="bool"  access="RC"/>
    <property name="exclusive"  type="bool"  access="RC"/>
    <property name="arguments"  type="map"   access="RO" desc="Arguments supplied in queue.declare"/>

    <statistic name="msgTotalEnqueues"    type="count64"  unit="message"     desc="Total messages enqueued"/>
    <statistic name="msgTotalDequeues"    type="count64"  unit="message"     desc="Total messages dequeued"/>
    <statistic name="msgTxnEnqueues"      type="count64"  unit="message"     desc="Transactional messages enqueued"/>
    <statistic name="msgTxnDequeues"      type="count64"  unit="message"     desc="Transactional messages dequeued"/>
    <statistic name="msgPersistEnqueues"  type="count64"  unit="message"     desc="Persistent messages enqueued"/>
    <statistic name="msgPersistDequeues"  type="count64"  unit="message"     desc="Persistent messages dequeued"/>
    <statistic name="msgDepth"            type="count32"  unit="message"     desc="Current size of queue in messages" assign="msgTotalEnqueues - msgTotalDequeues"/>
    <statistic name="byteDepth"           type="count32"  unit="octet"       desc="Current size of queue in bytes"    assign="byteTotalEnqueues - byteTotalDequeues"/>
    <statistic name="byteTotalEnqueues"   type="count64"  unit="octet"       desc="Total messages enqueued"/>
    <statistic name="byteTotalDequeues"   type="count64"  unit="octet"       desc="Total messages dequeued"/>
    <statistic name="byteTxnEnqueues"     type="count64"  unit="octet"       desc="Transactional messages enqueued"/>
    <statistic name="byteTxnDequeues"     type="count64"  unit="octet"       desc="Transactional messages dequeued"/>
    <statistic name="bytePersistEnqueues" type="count64"  unit="octet"       desc="Persistent messages enqueued"/>
    <statistic name="bytePersistDequeues" type="count64"  unit="octet"       desc="Persistent messages dequeued"/>
    <statistic name="enqueueTxnStarts"    type="count64"  unit="transaction" desc="Total enqueue transactions started "/>
    <statistic name="enqueueTxnCommits"   type="count64"  unit="transaction" desc="Total enqueue transactions committed"/>
    <statistic name="enqueueTxnRejects"   type="count64"  unit="transaction" desc="Total enqueue transactions rejected"/>
    <statistic name="enqueueTxnCount"     type="count32"  unit="transaction" desc="Current pending enqueue transactions"/>
    <statistic name="dequeueTxnStarts"    type="count64"  unit="transaction" desc="Total dequeue transactions started"/>
    <statistic name="dequeueTxnCommits"   type="count64"  unit="transaction" desc="Total dequeue transactions committed"/>
    <statistic name="dequeueTxnRejects"   type="count64"  unit="transaction" desc="Total dequeue transactions rejected"/>
    <statistic name="dequeueTxnCount"     type="count32"  unit="transaction" desc="Current pending dequeue transactions"/>
    <statistic name="consumerCount"       type="hilo32"   unit="consumer"    desc="Current consumers on queue"/>
    <statistic name="bindingCount"        type="hilo32"   unit="binding"     desc="Current bindings"/>
    <statistic name="unackedMessages"     type="hilo32"   unit="message"     desc="Messages consumed but not yet acked"/>
    <statistic name="messageLatency"      type="mmaTime"  unit="nanosecond"  desc="Broker latency through this queue"/>

    <method name="purge" desc="Discard all or some messages on a queue">
      <arg name="request"          dir="I" type="uint32" desc="0 for all messages or n>0 for n messages"/>
    </method>
  </class>

  <!--
  ===============================================================
  Exchange
  ===============================================================
  -->
  <class name="Exchange">
    <property name="vhostRef"   type="objId" references="Vhost" access="RC" index="y" parentRef="y"/>
    <property name="name"       type="sstr"  access="RC" index="y"/>
    <property name="type"       type="sstr"  access="RO"/>
    <property name="durable"    type="bool"  access="RC"/>

    <statistic name="producerCount" type="hilo32"  desc="Current producers on exchange"/>
    <statistic name="bindingCount"  type="hilo32"  desc="Current bindings"/>
    <statistic name="msgReceives"   type="count64" desc="Total messages received"/>
    <statistic name="msgDrops"      type="count64" desc="Total messages dropped (no matching key)"/>
    <statistic name="msgRoutes"     type="count64" desc="Total routed messages"/>
    <statistic name="byteReceives"  type="count64" desc="Total bytes received"/>
    <statistic name="byteDrops"     type="count64" desc="Total bytes dropped (no matching key)"/>
    <statistic name="byteRoutes"    type="count64" desc="Total routed bytes"/>
  </class>

  <!--
  ===============================================================
  Binding
  ===============================================================
  -->
  <class name="Binding">
    <property name="exchangeRef" type="objId" references="Exchange" access="RC" index="y" parentRef="y"/>
    <property name="queueRef"    type="objId" references="Queue"    access="RC" index="y"/>
    <property name="bindingKey"  type="sstr"  access="RC" index="y"/>
    <property name="arguments"   type="map"   access="RC"/>

    <statistic name="msgMatched" type="count64"/>
  </class>
  
  <!--
  ===============================================================
  Client
  ===============================================================
  -->
  <class name="Connection">
    <property name="vhostRef" type="objId"  references="Vhost" access="RC" index="y" parentRef="y"/>
    <property name="address"  type="sstr"   access="RC" index="y"/>
    <property name="incoming" type="bool"   access="RC"/>

    <statistic name="closing"          type="bool" desc="This client is closing by management request"/>
    <statistic name="authIdentity"     type="sstr"/>
    <statistic name="framesFromClient" type="count64"/>
    <statistic name="framesToClient"   type="count64"/>
    <statistic name="bytesFromClient"  type="count64"/>
    <statistic name="bytesToClient"    type="count64"/>

    <method name="close"/> 
  </class>

  <!--
  ===============================================================
  Link
  ===============================================================
  -->
  <class name="Link">

    This class represents an inter-broker connection.

    <property name="vhostRef"  type="objId"  references="Vhost" access="RC" index="y" parentRef="y"/>
    <property name="host"      type="sstr"   access="RC" index="y"/>
    <property name="port"      type="uint16" access="RC" index="y"/>
    <property name="useSsl"    type="bool"   access="RC"/>
    <property name="durable"   type="bool"   access="RC"/>

    <statistic name="state"       type="sstr" desc="Operational state of the link"/>
    <statistic name="lastError"   type="sstr" desc="Reason link is not operational"/>

    <method name="close"/> 

    <method name="bridge" desc="Bridge messages over the link">
      <arg name="durable"     dir="I" type="bool"/>
      <arg name="src"         dir="I" type="sstr"/>
      <arg name="dest"        dir="I" type="sstr"/>
      <arg name="key"         dir="I" type="sstr" default=""/>
      <arg name="tag"         dir="I" type="sstr" default=""/>
      <arg name="excludes"    dir="I" type="sstr" default=""/>
      <arg name="srcIsQueue"  dir="I" type="bool" default="0"/>
      <arg name="srcIsLocal"  dir="I" type="bool" default="0"/>
    </method>
  </class>


  <!--
  ===============================================================
  Bridge
  ===============================================================
  -->
  <class name="Bridge">
    <property name="linkRef"     type="objId"  references="Link" access="RC" index="y" parentRef="y"/>
    <property name="channelId"   type="uint16" access="RC" index="y"/>
    <property name="durable"     type="bool"   access="RC"/>
    <property name="src"         type="sstr"   access="RC"/>
    <property name="dest"        type="sstr"   access="RC"/>
    <property name="key"         type="sstr"   access="RC"/>
    <property name="srcIsQueue"  type="bool"   access="RC"/>
    <property name="srcIsLocal"  type="bool"   access="RC"/>
    <property name="tag"         type="sstr"   access="RC"/>
    <property name="excludes"    type="sstr"   access="RC"/>
    <method name="close"/> 
  </class>


  <!--
  ===============================================================
  Session
  ===============================================================
  -->
  <class name="Session">
    <property name="vhostRef"         type="objId"  references="Vhost" access="RC" index="y" parentRef="y"/>
    <property name="name"             type="sstr"   access="RC" index="y"/>
    <property name="channelId"        type="uint16" access="RO"/>
    <property name="connectionRef"    type="objId"  references="Connection" access="RO"/>
    <property name="detachedLifespan" type="uint32" access="RO" unit="second"/>

    <statistic name="attached"          type="bool"/>
    <statistic name="expireTime"        type="absTime"/>
    <statistic name="framesOutstanding" type="count32"/>

    <method name="solicitAck"/>
    <method name="detach"/>
    <method name="resetLifespan"/>
    <method name="close"/>
  </class>
</schema>

