OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

amqp message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Management schema example


Hi all,

Attached is the management schema and an explanatory readme from the
Qpid dispatch project. I'm curious to know what others think of it or
what others have done in this vein. Having a concrete notation to write
down your entity types, one that you can easily generate code and
documentation from, is extremely valuable. It may be too early to
standardize something like this but I offer it for discussion.

Cheers,
Alan.
{
    "description":  "Schema for the Qpid Dispatch Router management model. See qdrouter.json.readme.txt.",

    "prefix": "org.apache.qpid.dispatch",

    "annotations": {

        "addrPort": {
            "description": "Attributes for internet address and port.",
            "attributes": {
                "addr": {
                    "description":"Host address: ipv4 or ipv6 literal or a host name.",
                    "type": "String",
                    "default": "0.0.0.0"
                },
                "port": {
                    "description":"Port number or symbolic service name.",
                    "type": "String",
                    "default": "amqp"
                }
            }
        },

        "saslMechanisms": {
            "description": "Attribute for a list of SASL mechanisms.",
            "attributes": {
                "saslMechanisms": {
                    "type": "String",
                    "required": true,
                    "description": "Comma separated list of accepted SASL authentication mechanisms."
                }
            }
        },

        "connectionRole": {
            "description": "Attribute for the role of a connection.",
            "attributes": {
                "role": {
                    "type": [
                        "normal",
                        "inter-router",
                        "on-demand"
                    ],
                    "default": "normal",
                    "description": "The role of an established connection. In the normal role, the connection is assumed to be used for AMQP clients that are doing normal message delivery over the connection.  In the inter-router role, the connection is assumed to be to another router in the network.  Inter-router discovery and routing protocols can only be used over interRouter connections."
                }
            }
        },

        "sslProfile": {
            "description":"Attributes for setting TLS/SSL configuration for connections.",
            "attributes": {
                "certDb": {
                    "type": "String",
                    "description": "The path to the database that contains the public certificates of trusted certificate authorities (CAs)."
                },
                "certFile": {
                    "type": "String",
                    "description": "The path to the file containing the PEM-formatted public certificate to be used on the local end of any connections using this profile."
                },
                "keyFile": {
                    "type": "String",
                    "description": "The path to the file containing the PEM-formatted private key for the above certificate."
                },
                "passwordFile": {
                    "type": "String",
                    "description": "If the above private key is password protected, this is the path to a file containing the password that unlocks the certificate key."
                },
                "password": {
                    "type": "String",
                    "description": "An alternative to storing the password in a file referenced by passwordFile is to supply the password right here in the configuration file.  This option can be used by supplying the password in the 'password' option.  Don't use both password and passwordFile in the same profile."
                }
            }
        }
    },

    "entityTypes": {

        "entity": {
            "description": "Base entity type for all entities.",
            "attributes": {
                "name": {
                    "type": "String",
                    "required": false,
                    "unique": true,
                    "description": "Unique name, can be changed."
                },
                "identity": {
                    "type": "String",
                    "required": false,
                    "unique": true,
                    "description": "Unique identity, will not change."
                },
                "type": {
                    "type": "String",
                    "required": true,
                    "value": "$$entityType",
                    "description": "Management entity type."
                }
            }
        },

        "configurationEntity": {
            "description": "Base type for entities containing configuration information.",
            "extends": "entity",
            "attributes": {}
        },

        "operationalEntity": {
            "description": "Base type for entities containing current operational information.",
            "extends": "entity",
            "operations": ["READ"],
            "attributes": {}
        },

        "container": {
            "description":"Attributes related to the AMQP container.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "singleton": true,
            "attributes": {
                "containerName": {
                    "type": "String",
                    "description": "The  name of the AMQP container.  If not specified, the container name will be set to a value of the container's choosing.  The automatically assigned container name is not guaranteed to be persistent across restarts of the container."
                },
                "workerThreads": {
                    "type": "Integer",
                    "default": 1,
                    "description": "The number of threads that will be created to process message traffic and other application work (timers, non-amqp file descriptors, etc.) ."
                },
                "debugDump": {
                    "type": "String",
                    "description": "A file to dump debugging information that can't be logged normally."
                }
            }
        },

        "router": {
            "description":"Tracks peer routers and computes routes to destinations.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "singleton": true,
            "attributes": {
                "routerId": {
                    "description":"Router's unique identity.",
                    "type": "String"
                },
                "mode": {
                    "type": [
                        "standalone",
                        "interior",
                        "edge",
                        "endpoint"
                    ],
                    "default": "standalone",
                    "description": "In standalone mode, the router operates as a single component.  It does not participate in the routing protocol and therefore will not coorperate with other routers. In interior mode, the router operates in cooreration with other interior routers in an interconnected network.  In edge mode, the router operates with an uplink into an interior router network. Edge routers are typically used as connection concentrators or as security firewalls for access into the interior network."
                },
                "area": {
                    "type": "String",
                    "description": "Unused placeholder."
                },
                "helloInterval": {
                    "type": "Integer",
                    "default": 1,
                    "description": "Interval in seconds between HELLO messages sent to neighbor routers."
                },
                "helloMaxAge": {
                    "type": "Integer",
                    "default": 3,
                    "description": "Time in seconds after which a neighbor is declared lost if no HELLO is received."
                },
                "raInterval": {
                    "type": "Integer",
                    "default": 30,
                    "description": "Interval in seconds between Router-Advertisements sent to all routers in a stable network."
                },
                "raIntervalFlux": {
                    "type": "Integer",
                    "default": 4,
                    "description": "Interval in seconds between Router-Advertisements sent to all routers during topology fluctuations."
                },
                "remoteLsMaxAge": {
                    "type": "Integer",
                    "default": 60,
                    "description": "Time in seconds after which link state is declared stale if no RA is received."
                },
                "mobileAddrMaxAge": {
                    "type": "Integer",
                    "default": 60,
                    "description": "Deprecated - This value is no longer used in the router."
                },
	        "addrCount": {"type": "Integer", "description":"Number of addresses known to the router."},
	        "linkCount": {"type": "Integer", "description":"Number of links attached to the router node."},
	        "nodeCount": {"type": "Integer", "description":"Number of known peer router nodes."}
            }
        },

        "listener": {
            "description": "Listens for incoming connections to the router.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "annotations": [
                "addrPort",
                "connectionRole",
                "sslProfile",
                "saslMechanisms"
            ],
            "attributes": {
                "requirePeerAuth": {
                    "type": "Boolean",
                    "default": true,
                    "description": "Only for listeners using SSL.  If set to 'yes', attached clients will be required to supply a certificate.  If the certificate is not traceable to a CA in the ssl profile's cert-db, authentication fails for the connection."
                },
                "trustedCerts": {
                    "type": "String",
                    "description": "This optional setting can be used to reduce the set of available CAs for client authentication.  If used, this setting must provide a path to a PEM file that contains the trusted certificates."
                },
                "allowUnsecured": {
                    "type": "Boolean",
                    "default": false,
                    "description": "For listeners using SSL only.  If set to 'yes', this option causes the listener to watch the initial network traffic to determine if the client is using SSL or is running in-the-clear.  The listener will enable SSL only if the client uis using SSL."
                },
                "allowNoSasl": {
                    "type": "Boolean",
                    "default": false,
                    "description": "If set to 'yes', this option causes the listener to allow clients to connect even if they skip the SASL authentication protocol."
                },
                "maxFrameSize": {
                    "type": "Integer",
                    "default": 65536,
                    "description": "Defaults to 65536.  If specified, it is the maximum frame size in octets that will be used in the connection-open negotiation with a connected peer.  The frame size is the largest contiguous set of uniterruptible data that can be sent for a message delivery over the connection. Interleaving of messages on different links is done at frame granularity."
                }
            }
        },

        "connector": {
            "description": "Establishes an outgoing connections from the router.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "annotations": [
                "addrPort",
                "connectionRole",
                "sslProfile",
                "saslMechanisms"
            ],
            "attributes": {
                "allowRedirect": {
                    "type": "Boolean",
                    "default": true,
                    "description": "Allow the peer to redirect this connection to another address."
                },
                "maxFrameSize": {
                    "type": "Integer",
                    "default": 65536,
                    "description": "Maximum frame size in octets that will be used in the connection-open negotiation with a connected peer.  The frame size is the largest contiguous set of uniterruptible data that can be sent for a message delivery over the connection. Interleaving of messages on different links is done at frame granularity."
                }
            }
        },

        "log": {
            "description": "Configure logging for a particular module.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ", "UPDATE"],
            "attributes": {
                "module": {
                    "type":[
                        "ROUTER",
                        "ROUTER_HELLO",
                        "ROUTER_LS",
                        "ROUTER_MA",
                        "MESSAGE",
                        "SERVER",
                        "AGENT",
                        "CONTAINER",
                        "CONFIG",
                        "ERROR",
                        "DISPATCH",
                        "DEFAULT"
                    ],
                    "required": true,
                    "description": "Module to configure. The special module 'DEFAULT' specifies defaults for all modules."
                },
                "enable": {
                    "type": "String",
                    "default": "default",
                    "required": true,
                    "description": "Levels are: trace, debug, info, notice, warning, error, critical. The enable string is a comma-separated list of levels. A level may have a trailing '+' to enable that level and above. For example 'trace,debug,warning+' means enable trace, debug, warning, error and critical. The value 'none' means disable logging for the module. The value 'default' means use the value from the DEFAULT module."
                },
                "timestamp": {
                    "type": "Boolean",
                    "description": "Include timestamp in log messages."
                },
                "source": {
                    "type": "Boolean",
                    "description": "Include source file and line number in log messages."
                },
                "output": {
                    "type": "String",
                    "description": "Where to send log messages. Can be 'stderr', 'syslog' or a file name."
                }
            }
        },

        "fixedAddress": {
            "description":"Establishes semantics for addresses starting with a prefix.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "attributes": {
                "prefix": {
                    "type": "String",
                    "required": true,
                    "description": "The address prefix (always starting with '/')."
                },
                "phase": {
                    "type": "Integer",
                    "description": "The phase of a multi-hop address passing through one or more waypoints."
                },
                "fanout": {
                    "type": [
                        "multiple",
                        "single"
                    ],
                    "default": "multiple",
                    "description": "One of 'multiple' or 'single'.  Multiple fanout is a non-competing pattern.  If there are multiple consumers using the same address, each consumer will receive its own copy of every message sent to the address.  Single fanout is a competing pattern where each message is sent to only one consumer."
                },
                "bias": {
                    "type": [
                        "closest",
                        "spread"
                    ],
                    "default": "closest",
                    "description": "Only if fanout is single.  One of 'closest' or 'spread'.  Closest bias means that messages to an address will always be delivered to the closest (lowest cost) subscribed consumer. Spread bias will distribute the messages across subscribers in an approximately even manner."
                }
            }
        },

        "waypoint": {
            "description":"A remote node that messages for an address pass through.",
            "extends": "configurationEntity",
            "operations": ["CREATE", "READ"],
            "attributes": {
                "address": {
                    "description":"The AMQP address of the waypoint.",
                    "type": "String",
                    "required": true
                },
                "connector": {
                    "description":"The name of the on-demand connector used to reach the waypoint's container.",
                    "type": "String",
                    "required": true
                },
                "inPhase": {
                    "description":"The phase of the address as it is routed _to_ the waypoint.",
                    "type": "Integer",
                    "default": -1
                },
                "outPhase": {
                    "description":"The phase of the address as it is routed _from_ the waypoint.",
                    "type": "Integer",
                    "default": -1
                }
            }
        },

        "dummy": {
            "description": "Dummy entity for test purposes.",
            "extends": "entity",
            "operations": ["CREATE", "READ", "UPDATE", "DELETE", "CALLME"],
            "attributes": {
                "arg1": {"type": "String"},
                "arg2": {"type": "String"},
                "num1": {"type": "Integer"},
                "num2": {"type": "Integer"}
            }
        },


        "router.link": {
            "description": "Link to another AMQP endpoint: router node, client or other AMQP process.",
            "extends": "operationalEntity",
            "attributes": {
                "linkName": {"type": "String"},
                "linkType": {"type": ["endpoint", "waypoint", "inter-router", "inter-area"]},
                "linkDir": {"type": ["in", "out"]},
                "owningAddr": {"type": "String"},
                "eventFifoDepth": {"type": "Integer"},
                "msgFifoDepth": {"type": "Integer"},
                "remoteContainer": {"type": "String"}
            }
        },

        "router.address": {
            "description": "AMQP address managed by the router.",
            "extends": "operationalEntity",
            "attributes": {
                "inProcess": {"type": "Boolean"},
                "subscriberCount": {"type": "Integer"},
                "remoteCount": {"type": "Integer"},
                "deliveriesIngress": {"type": "Integer"},
                "deliveriesEgress": {"type": "Integer"},
                "deliveriesTransit": {"type": "Integer"},
                "deliveriesToContainer": {"type": "Integer"},
                "deliveriesFromContainer": {"type": "Integer"}
            }
        },

        "router.node": {
            "description": "AMQP node managed by the router.",
            "extends": "operationalEntity",
            "attributes": {
                "addr": {"type": "String"},
                "nextHop": {"type": "Integer"},
                "routerLink": {"type": "Integer"},
                "validOrigins": {"type": "List"}
            }
        },

        "connection": {
            "description": "Connections to the router's container.",
            "extends": "operationalEntity",
            "attributes": {
                "container": {"type": "String"} ,
                "state": {"type": [
                    "connecting",
                    "opening",
                    "operational",
                    "failed",
                    "user"
                ]},
                "host": {"type": "String"},
                "dir": {"type": ["in", "out"]},
                "role": {"type": "String"},
                "sasl": {"type": "String"}
            }
        },

        "allocator": {
            "description": "Memory allocation pool.",
            "extends": "operationalEntity",
            "attributes": {
                "typeSize": {"type": "Integer"},
                "transferBatchSize": {"type": "Integer"},
                "localFreeListMax": {"type": "Integer"},
                "globalFreeListMax": {"type": "Integer"},
                "totalAllocFromHeap": {"type": "Integer"},
                "totalFreeToHeap": {"type": "Integer"},
                "heldByThreads": {"type": "Integer"},
                "batchesRebalancedToThreads": {"type": "Integer"},
                "batchesRebalancedToGlobal": {"type": "Integer"}
            }
        }
    }
}
<!--*-markdown-*-
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.
-->

# The qdrouter management schema

The schema `qdrouterd.json` is a JSON format file that defines annotations and
entity types of the Qpid Dispatch Router management model.  The model is based
on the AMQP management specification.

The schema is a JSON map with the following keys:

- "description": documentation string for the schema
- "prefix": Prefix prepended to schema names when they are exposed to AMQP management clients.

- "entityTypes": map of entity type names to definitions (see below)

Annotation and entity type definition maps have the following keys:

- "description": documentation string.
- "operations": list of allowed operation names.
- "attributes": map of attribute names to attribute definitions (see below)

Entity type definitions also have these fields:

- "extends": Name of base type. The new type includes operations and attributes from the base type.
- "annotations": List of annotation names. The new type includes operations and attributes from all the annotations.

Attribute definition maps have the following fields:

- "type": one of the following:
  - "String": a unicode string value.
  - "Integer": an integer value.
  - "Boolean": a true/false value.
  - [...]: A list of strings is an enumeration. Values must be one of the strings or an integer integer index into the list, starting from 0.
- "default": a default can be a literal value or a reference to another attribute in the form `$attributeName`.

There is the following hierarchy among entity types:

`entity`: The base of all entity types.
- `configurationEntity`: base for all types that hold *configuration information*.

  Configuration information is supplied in advance and expresse *intent*. For
  example "I want the router to listen on port N". All the entities that can be
  used in the configuration file extend `configurationEntity`.

- `operationalEntity`: base for all types that hold *operational information*.

  Operational information reflects the actual current state of the router.  For
  example, "how many addresses are presently active?" All the entities queried
  by the `qdstat` tool extend `operationalEntity`.

The two types are often related. For example `listener` and `connector` extend
`configurationEntity`, they express the intent to make or receive
connections. `connection` extends `operationalEntity`, it holds information
the actual connection status.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]