Assembly: mindtouch.dream
Class: MindTouch.Dream.EventsService
SID: http://services.mindtouch.com/dream/...2007/03/events
The Events service provides simple publication/subscription API for messages. An application publishes a message by doing a POST:events/ request on the service. The service will queue the message, give it a unique eventid, and notify any active listeners about its arrival.
Listeners can be notified via two different means: either they subscribe to the event service with a POST:subscribe/ request, or they poll with a GET:events/ request. The latter can be set to wait until a message arrives, avoiding repetitive polling operations when no messages are present.
| Verb:Suffix | Description |
| GET:events | Get list of all messages |
| GET: | Get list of all messages |
| POST:events | Add a message |
| POST: | Add a message |
| POST:subscribe | Add a subscriber |
| POST:unsubscribe | Remove a subscriber |
<config> <!-- default duration in seconds to keep a message for --> <default-ttl>30</default-ttl> <!-- default duration in seconds to keep a GET:events/ operation alive when no messages are present --> <default-wait>10</default-wait> </config>
A message can be any valid XML document. Every message is tagged with a sequential eventid and eventdate (Beryil and later). If the following document is posted to the Events service.
<ticker> <symbol>GE</symbol> <price>32.82</price> </ticker>
It will be sent to listeners as:
<ticker eventid="42" eventdate="2006-05-22T01:16:03.0716064Z"> <symbol>GE</symbol> <price>32.82</price> </ticker>
<list maxeventid="42" eventdate="2006-05-22T01:16:03.0716064Z"> <ticker eventid="42"> <symbol>GE</symbol> <price>32.82</price> </ticker> </list>
<subscription> <uri>http://localhost/myService/myListener</node> </subscription>
| Name | Type | Default
|
Description |
| after | int | 0 | Only send events that occurred after this eventid |
| wait | int? | variable | Duration in seconds to block the request until until a message arrives. Default behavior does not block. Value can be omitted, defaulting to service specific duration. |
| Status | Response Body | Description |
| 200 | MessageList | A list of messages matching the request. |
| Name | Type | Default
|
Description |
| after | int | 0 | Only send events that occurred after this eventid |
| wait | int? | variable | Duration in seconds to block the request until until a message arrives. Default behavior does not block. Value can be omitted, defaulting to service specific duration. |
| Status | Response Body | Description |
| 200 | MessageList | A list of messages matching the request. |
Add a message to the list of messages. If any listeners are waiting or if subscribers are present, notify them about the new message.
| Name | Type | Defaut
|
Description |
| ttl | double | variable | Time-to-live in seconds for the posted message. If not specified, service default will be used.
|
The request body must contain a valid XML document.
| Status | Response Body | Description |
| 200 | --- | No result returned. |
Beryl: ttl is now a double representing seconds (in Aqua, it was an integer representing days)
Aqua: feature added
Add a message to the list of messages. If any listeners are waiting or if subscribers are present, notify them about the new message.
| Name | Type | Defaut
|
Description |
| ttl | double | variable | Time-to-live in seconds for the posted message. If not specified, service default will be used. |
The request body must contain a valid XML document.
| Status | Response Body | Description |
| 200 | --- | No result returned. |
Aqua: feature added
Adds a subscriber to the Events service. By default, a new subscriber only receives messages that are sent after the subscription has been established. However, by providing the after query parameter, this behavior can be changed to return all message in the Event service that occurred after the specified eventid, but before the subscription was established.
| Name | Type | Defaut
|
Description |
| after | int | MaxInt | Only send events that occurred after this eventid. |
A Subscription XML document specifying the uri of the subscriber.
| Status | Response Body | Description |
| 200 | --- | No result returned. |
| 400 | XHTML | The reason why the request failed. |
Removes a subscriber from the Events service. This operation succeeds regardless if the specified subscription has established a subscription or not.
A Subscription XML document specifying the uri of the subscriber.
| Status | Response Body | Description |
| 200 | --- | No result returned. |
Aqua: feature added