Assembly: mindtouch.dream
    Class: MindTouch.Dream.MessageBusService
    SID: http://services.mindtouch.com/dream/.../09/messagebus

    Overview

    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:

    1. A request for a channel (either to publish or subscribe) arrives at the Bus.
    2. If the Bus already has the channel defined in its roster, the request is routed to the channel handler
    3. If there is no existing channel handler, the Bus will iterate through its handlers matching the channel to the handlers pattern, trying to find a handler that wants the channel. Since the default handler matches on * there will always be a handler.
    4. Once a handler is matched, it is told to create the channel and the Bus adds the channel to its roster.
    5. Now the request can be routed to handler.

     

    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

    Data Types

    Config

    <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 Information

    <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>
    

     

    Published Message../../../../User:Arnec/Dream_Message_Bus/MessageBus#

    <message-envelope guid="52345105-b419-458b-ad14-de7cabcdd181">
        <data>
            <!-- provided Xml message -->    
        </data>
    </subscription>
    

     

    SubscriptionEdit section

    <subscription>
        <token>ewfj0923jewf0wjfew</token>
    </subscription>
    

     

    Features

    GET:services

    Returns an XML document of the bus information for all known channel.

    Response
    Status Response Body Description
    OK (200) text/xml operation completed successfully
    Version History

     


    POST:publish/{channelpath}

    Returns an XML document of the bus information for just the specified path or 404 if no such path is registered.

    Response
    Status Response Body Description
    OK (200) text/xml operation completed successfully
    Not Found (404) -- the specified path does not exists as a subscription endpoint
    Version History

      


    POST:subscribe/{channelpath}

    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.

    Query Parameters
    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
    Request body

    text/html of the URI to post messages to

    Response
    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
    Version History

     


    POST:unsubscribe/{channelpath}

    Remove a subscription from the path for the specified URL.

    Query Parameters
    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
    Response
    Status Response Body Description
    OK (200) --- operation completed successfully
    Version History

     

     

    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by