stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmal Fernando <nirmal070...@gmail.com>
Subject Cloud Controller - Create an extension point to attach different configuration (topology) publishers
Date Wed, 07 Aug 2013 17:05:23 GMT
Hi All,

I worked on the $subject as and when I got time. And believe that I clearly
separated out and provided an extension point to add any custom topology
publisher.

While doing this I had to change the current configuration of topology
publisher as below:

   * <topologySync enable="true">
        <!-- properties related to topology syncher -->
        <property name="className"
value="org.apache.stratos.cloud.controller.ABC"/>
        <property name="mbServerUrl" value="localhost:5674"/>
        <property name="cron" value="1 * * * * ? *"/>
    </topologySync>*


If you want to plug a new implementation instead of using the default
implementation (WSO2MBTopologyPublisher), you should extend the following
abstract class and configure it using a property (eg: *<property
name="className" value="org.apache.stratos.cloud.controller.ABC"/>)*.

*package org.apache.stratos.cloud.controller.interfaces;

/**
 * All custom implementations of Topology Publisher should extend this
abstract class.
 */
public abstract class TopologyPublisher {

    /**
     * This operation will be called once in order to initialize this
publisher.
     */
    public abstract void init();

    /**
     * When a message is ready to be published to a certain topic, this
operation will be called.
     * @param topicName name of the topic to be published.
     * @param message message to be published.
     */
    public abstract void publish(String topicName, String message);

    /**
     * Cron expression which explains the frequency that the topology
publishing happens.
     * @return cron expression
     */
    public abstract String getCron();

}*

You have the freedom to get any necessary parameters for your custom
topology publisher implementation, due to the nature of the configuration
shown above. Any number of properties are allowed and those can be
retrieved via the object model.

eg:

        *TopologyConfig config = FasterLookUpDataHolder.getInstance()
                .getTopologyConfig();
        String cron =
config.getProperty(CloudControllerConstants.CRON_ELEMENT);*

With this extension point in hand, you can easily make Cloud Controller to
publish topology information into another topic provider (Qpid etc.).

*I invite you to leverage this capability and help Apache Stratos to be
compatible with other message broker implementations.

*
*Thanks.
*

PS: We need the same kind of extensibility in the subscriber side. I will
have a look on to it too.

-- 
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Senior Software Engineer,
WSO2 Inc.

Blog: http://nirmalfdo.blogspot.com/

Mime
View raw message