Hi,

I've been working on improving the sample event publisher tool [1]
that was initially developed by Imesh as a developer testing tool for
Stratos. This tool uses the same messaging component in Apache Stratos
and can be used to generate custom event messages. It has proven to be
extremely valuable when developing cartridge agent extensions and also
as a debugging tool.

I've added JAXB XML binding to read sample events from an XML file and
publish the events. Also this model can be easily customized to
support new events. For eg - to send an Instance Activated event to
the instance notifier topic following XML code can be used. A more
detailed sample is found in [2]

    <InstanceActivatedEvent>
       <serviceName>service-2</serviceName>
       <clusterId>cluster-2</clusterId>
        <memberId>member-1</memberId>
        <partitionId>partitionId-1</partitionId>
        <networkPartitionId>np-1</networkPartitionId>
    </InstanceActivatedEvent>


 It's not only message events, it can be used to execute action events
too. For eg - if you want to pause between 2 events for 1 second;

<SleepEvent>
<duration>1000</duration>
</SleepEvent>


Another improvement is that you can bundle the whole application as a
stand-alone Java app. Earlier it was only possible to run it using
Maven which is not portable. So I added Maven assembly plugin to
create a stand-alone zip bundle. Complete code can be found at [1]. I
hope you will all find it very useful.

[1] https://github.com/ravihansa3000/apache-stratos-samples

[2] 
https://github.com/ravihansa3000/apache-stratos-samples/blob/master/sample-event-publisher/src/main/resources/SampleEvents.xml

Thanks.

-- 
Akila Ravihansa Perera
Software Engineer, WSO2

Blog: http://ravihansa3000.blogspot.com

Reply via email to