Assembly: mindtouch.dream
Class: MindTouch.Dream.MessageBusService
SID: http://services.mindtouch.com/dream/.../09/messagebus
The MessageBus is a universal component of Dream. It is created and attached in the host environment and is a Property on IDreamService (and implemented by the DreamService base class). It is the visible service for other services to interact with the bus. It is, however just a router to the services that handle the transport of channels.
By default, MessageBus will create one instance of MessageBusChannelService with a pattern of *, i.e. matching any channel and dynamically creating channels on demand. Other channel transports can be added at configuration time by provided the bus the SID and channel pattern for a channel transport.
The way that messages are routed to channels is as follows:
| Verb:Suffix | Description |
| GET:services | Get all information about all known channels |
| POST:publish/{channelpath} | Post a message to a channel |
| POST:subscribe/{channelpath} | Subscribe to a message channel |
| POST:unsubscribe/{channelpath} | Remove subscription from a message channel |
<config> <channel-service handles-publication="true|false" handles-subscription="true|false"> <SID>http://some/sid/</SID> <channels>/some/pattern/*</channel> <channels>/another/pattern/*</channel> <config> <!-- channel service config.. used to configure child service--> <!-- Xmpp publisher/subscriber only --> <xmpp> <connect-server>xmpp.somedomain.com</connect-server> <xmpp-id>publisher@somedomain.com</xmpp-id> <password>a239jwefd</password> </xmpp> </config> </channel-service> </config>
<bus> <services> <channel-service handles-publication="true|false" handles-subscription="true|false"> <channels>/foo/*</channels> <channels>/bar/*</channels> <url>http://url/to/service</url> <SID>http://some/sid/</SID> </channel> ... </services> <channels> <channel handles-publication="true|false" handles-subscription="true|false"> <path>/foo/bar</bar> <url>http://url/to/service</url> </channel> <channels> </bus>
<message-envelope guid="52345105-b419-458b-ad14-de7cabcdd181">
<data>
<!-- provided Xml message -->
</data>
</subscription>
<subscription>
<token>ewfj0923jewf0wjfew</token>
</subscription>
Returns an XML document of the bus information for all known channel.
| Status | Response Body | Description |
| OK (200) | text/xml | operation completed successfully |
Returns an XML document of the bus information for just the specified path or 404 if no such path is registered.
| Status | Response Body | Description |
| OK (200) | text/xml | operation completed successfully |
| Not Found (404) | -- | the specified path does not exists as a subscription endpoint |
Register a URL with the MessageBusSubscriber to which messages arriving at the bus path are POSTed back to. The URL being registered should also expect a Query parameter of channel identifying the originating channel.
| Name | Type | Default | Description |
| uri | string | The URI the bus should post messages on the channel to | |
| retry | int | 3 | The number of times the bus should retry posting a message before giving up |
| retry-sleep | int | 10 | Seconds to sleep between retries |
| rate | double | infinity | The rate of messages per second at which the subscriber service pushes to the subscribed services. Unthrottled by default |
text/html of the URI to post messages to
| Status | Response Body | Description |
| OK (200) | text/xml | operation completed successfully |
| Not Found (404) | text/html | the specified path does not exists as a subscription endpoint |
Remove a subscription from the path for the specified URL.
| Name | Type | Default | Description |
| uri | string | The URI the bus should post messages on the channel to | |
| token | string | n/a | Subscription token returned at subscription time |
| Status | Response Body | Description |
| OK (200) | --- | operation completed successfully |
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by