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: Re: [amqp] [management] Proposal for event notifications (initial outline)


On Mon, 2015-02-16 at 10:28 -0800, Matthew Arrott wrote:
> As I read this, there are two parts to this proposal:
> 
> 1) Attribute Name Representation Optimization to obtain small size messages
> 
> +1 with question: Is this attributeName list optimization something that
> can be applied to all attributes across all subscriptions?

I see it working like the QUERY operation response does. You can specify
an arbitrary list of attribute names and an arbitrary filter that can
return events of multiple eventTypes. For each matching event we simply
match attribute names in the attributeList to the attributes of the
event and fill in the value or NULL.

This bothered me a bit when I first saw QUERY but now I find it gives a
good simplicity/flexibility tradeoff. The bothersome part is it is not
very "type safe". Say there are two event types X and Y, both have an
attribute "foo" with completely different meanings. You subscribe with a
filter that includes X and Y events with attributeList=["foo"]. When you
get a compressed event from such a subscription you know it's a "foo"
value but you don't know if it's an X.foo or a Y.foo so you don't know
what it means. (Note this is exactly the same situation as issuing a
QUERY with no entityType property and an attributeList that does not
include the "type" attribute)

The solution of course is "don't do that!" You can avoid ambiguity in
two ways:
1. Have separate subscriptions each with only one event type OR
2. Include "eventType" in your attributeList. Then you know exactly what
type each event is.

What I now like about this is that it is easy to use on both ends. The
QUERY messages or link attach properties are easy to construct and parse
and the rules are easy to understand. It is possible to construct
ambiguous queries but it's pretty obvious how to avoid it. I suspect a
more type-safe approach would be much more verbose.


> 
> 2) Generate a set of Standard EventTypes from the performatives in the
> AMQP spec
> 
> Question: Are the associated  EventType attributes for each of the
> performatives all well know and/or null?

I don't know, I threw that out as a possible useful source of standard
event types but I haven't tried to analyse them. It isn't my first
priority implementation-wise but it will probably come fairly quickly.
First I need events to satisfy a particular use case, but then I will
need to fill out a generally useful set of event types. The AMQP spec
might be the place to start.

> 
> -----Original Message-----
> From: Alan Conway <aconway@redhat.com>
> Date: Monday, February 16, 2015 at 8:24 AM
> To: John O'Hara <john@rjohara.com>
> Cc: <amqp@lists.oasis-open.org>, Matthew Arrott <marrott@ucsd.edu>,
> "Godfrey, Robert X" <robert.godfrey@jpmorgan.com>
> Subject: Re: [amqp] [management] Proposal for event notifications (initial
> outline)
> 
> 
> I have a couple of thoughts for extending the event notification
> proposal, the original is below for reference. I'll put them all
> together if after any feedback.
> 
> *Event meta-data*: Add a GET-EVENTS operation to the "self" entity (like
> existing GET-ATTRIBUTES) to get a map of event-type name to attribute
> name list.
> 
> 
> *Compact event representation*: The current proposal is very fat on the
> wire - attribute names are repeated in every notification and there's no
> way to select a subset of attributes. I suggest the following addition
> inspired by the existing QUERY response:
> 
> When subscribing for events the link attach properties MAY contain the
> key `attributeNames` with a list of attribute names. If so, event
> messages are tested against the filter as before, but are sent in a
> compact form. Attribute names/values are not sent in the application
> properties, instead the body contains a list of attribute values in the
> same order as `attributeNames`. Missing attributes are represented by
> NULL values.
> 
> Without `attributeNames` you get the names and values. This is less
> efficient but may be easier to work with for dynamic or exploratory
> tools that can interact with many different implementations. With
> `attributeNames` you get just what you ask for with no overhead. This is
> better for tools that know what they want, and in heavy traffic systems
> where the overhead of attribute names is excessive.
> 
> 
> *Standard event types*: We could probably generate a reasonable set of
> standard event types directly from the performatives in the AMQP spec.
> Every performative (link-open, connection-open, disposition etc.) does
> signify and event that might be of interest to a management console. Is
> it too early to think about standardizing this?  Are there any pitfalls?
> 
> 
> 
> Original proposal
> -----------------
> 
> # AMQP Management Event Notification
> 
> Management clients often need to know when the state of a managed entity
> has changed.  This can be for monitoring or logging purposes, or to
> react when something becomes ready for use.
> 
> Polling the management agent for changes with READ or QUERY operations
> is inefficient. Clients either poll too often, which overloads the
> agent, or too seldom which causes needless delays in the system.
> 
> Event notification allows management clients to subscribe for continuous
> notification of selected events as soon as the agent becomes aware of
> them.
> 
> ## Event Types
> 
> An Event Type is a named set of attributes. The name is a case-sensitive
> string. Implementers MAY define their own Event Types which MUST be
> named using a reverse domain name prefix owned by the implementer, e.g.
> "com.example.broker.queueDeleted".
> 
> Every Event Type MUST have an attribute "eventType" which carries the
> Event Type name as a string. Implementers may define additional required
> or optional attributes for their Event Types.
> 
> Event Types do not have operations, annotations or extensions. No
> standard event types are defined by this specification.
> 
> ## Notification Messages
> 
> A notification message contains a single event. The message subject MUST
> be the Event Type name.  The application-properties MUST include all
> required attributes for that Event Type, in particular "eventType" with
> the Event Type name.  They MAY include any optional attributes for the
> Event Type.
> 
> ## Subscribing for Event Notification
> 
> To subscribe for notification messages, a client creates a link from the
> address "$management.events" with a *filter* (TODO xref) describing the
> events that it is interested in.  Closing the link ends the
> subscription.
> 
> The filtering capabilities depend on the filters provided by the agent.
> An agent SHOULD provide the APACHE.ORG:SELECTOR described in
> <http://www.amqp.org/specification/1.0/filters>.  This allows clients to
> filter on arbitrary SQL-like expressions over all the attributes of the
> event including "eventType".
> 
> Since the event type MUST also be included in the message subject, even
> simple filters (for example the legacy filters described in
> <http://www.amqp.org/specification/1.0/filters>) MAY be used to filter
> by event type.
> 
> Any filter that can operate on the subject or application-properties of
> a message will be able to work with event notification messages, but for
> flexibility and interoperability implementers SHOULD provide
> APACHE.ORG:SELECTOR.
> 
> ----
> 
> # Notes, not part of the spec:
> 
> Needs cross references to relevant sections on filters etc.
> 
> This design does not allow multiple events to be batched in a single
> message. IMO an implementation should batch messages at the transport
> (into TCP packets) NOT batch events into a message. Batching in messages
> complicates the client, defeats transport level batching (by forcing
> "fat" messages on the transport) and rules out (or badly complicates)
> the use of AMQP filters to select events.
> 
> I considered an alternative design where the client sends a subscription
> request with a reply-to address and the agent then sends notification
> messages to the reply-to address.
> 
> I rejected that design for the following reasons:
> 
> 1. It is impossible in general to tell when such a subscriber goes away
> if it crashes or fails to send an explicit unsubscribe message.
> Implementations must already deal with closing links when clients
> disconnect or heartbeat out so using links solves this problem. Even in
> an indirect topology (like link-routed Qpid dispatch networks) the
> routers must proxy link closure to be AMQP-correct.
> 
> 2. We should use AMQP standard features to solve AMQP problems, not
> re-invent the wheel in a form only useful for management.
> Filters/selectors were designed for exactly this purpose we should make
> them work for us.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this mail list, you must leave the OASIS TC that
> generates this mail.  Follow this link to all your TCs in OASIS at:
> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
> 
> 
> 
> 




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