You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Akila Ravihansa Perera <ra...@wso2.com> on 2014/08/30 11:28:45 UTC

Sample Event Publisher for Apache Stratos

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

Re: Sample Event Publisher for Apache Stratos

Posted by chris snow <ch...@gmail.com>.
+1 excellent contribution.  It would be good to see the documentation
for using this under the developer section of the wiki :)

On Mon, Sep 1, 2014 at 1:58 PM, Gayan Gunarathne <ga...@wso2.com> wrote:
>
> Thanks Akila. This will be really helpful with testing Stratos components
> like Cartridge agent etc..
>
> Thanks,
> Gayan
>
>
>
> On Sat, Aug 30, 2014 at 2:58 PM, Akila Ravihansa Perera <ra...@wso2.com>
> wrote:
>>
>> 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
>
>
>
>
> --
> Best Regards,
>
> Gayan Gunarathne
> Technical Lead
> WSO2 Inc. (http://wso2.com)
> email  : gayang@wso2.com  | mobile : +94 766819985
>

Re: Sample Event Publisher for Apache Stratos

Posted by Gayan Gunarathne <ga...@wso2.com>.
Thanks Akila. This will be really helpful with testing Stratos components
like Cartridge agent etc..

Thanks,
Gayan



On Sat, Aug 30, 2014 at 2:58 PM, Akila Ravihansa Perera <ra...@wso2.com>
wrote:

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



-- 
Best Regards,

Gayan Gunarathne
Technical Lead
WSO2 Inc. (http://wso2.com)
email  : gayang@wso2.com  | mobile : +94 766819985