esper examples
Hello,
I am trying to get a simple esper example working.
Copy and pasting the example from the webinar does not work
http://wso2.org/files/wso2-esb-webinar-cep-july-29th.pdf
2008-08-12 21:41:44,921 [] [WrapperSimpleAppMain] ERROR AxiomMediator An error occured while setting EPL statement Failed to resolve event type: Failed to load class Ticker [select * from Ticker.win:length_batch(10)]
Thanks
Alex
- Login or register to post comments
- Printer friendly version
- 326 reads











Esper Example
Hi Alex,
I did try to recreate your problem but couldn't, it is working on my environment. Can you please use the attached Synapse config file (synapse.xml) and send us the result.
Thx
Asanka A.
<definitions xmlns="http://ws.apache.org/ns/synapse"> <task class="org.apache.synapse.startup.tasks.MessageInjector" name="Tick"> <property name="to" value="urn:tick" /> <property name="soapAction" value="urn:tick" /> <property name="message"> <tick xmlns="http://mycom.com/ns/tick"> <s>IBM</s> <p>89.6</p> </tick> </property> <trigger interval="1" /> </task> <filter source="get-property('To')" regex="urn:tick"> <log level="custom"> <property name="Incomming msg" expression="get-property('To')" /> </log> <class name="org.sciflex.plugins.synapse.esper.mediators.AxiomMediator"> <property name="Configuration"> <esper-configuration> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.espertech.com/schema/esper" xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd"> <plugin-event-representation uri="type://xml/apacheaxiom/OMNode" class-name="com.espertech.esperio.representation.axiom.AxiomEventRepresentation" /> <plugin-event-type alias="Ticker"> <resolution-uri value="type://xml/apacheaxiom/OMNode" /> <initializer> <xml-axiom root-element-name="getQuote" default-namespace="http://mycom.com/ns/tick"> <namespace-prefix prefix="t" namespace="http://mycom.com/ns/tick" /> <xpath-property property-name="symbol" xpath="//t:tick/t:s" type="string" /> <xpath-property property-name="price" xpath="//t:tick/t:p" type="number" /> </xml-axiom> </initializer> </plugin-event-type> </esper-configuration> </property> <property name="statement" value="select * from Ticker.win:length_batch(10)" /> <property name="EventToAddress" value="urn:newevent" /> </class> <log level="custom"> <property name="Modified" expression="get-property('To')" /> </log> <log level="full" /> </filter> <filter source="get-property('To')" regex="urn:newevent"> <log level="full" /> </filter> </definitions>My environment as follows
Hi,
Hi,
Thanks for your swift reply and assistance.
I am running
wso2esb-1.7
java 1.6.0_05
esper 2.1.0 plus other required jars
I don't get the class not found exception anymore but I am not getting any messages through to the newevent filter.
I changed the following:
<xml-axiom root-element-name="getQuote"
to:
<xml-axiom root-element-name="tick"
And it works in terms of firing newevents and getting a newevent only once every 10 tick events.
Can you confirm what I have done is correct?
Thanks,
Alex
Esper Exple to print the 10th Event
Hi Alex,
Yes, to only print the 10th event the change you have done is correct. I have attached the updated configuration file synapse.xml.
Thx
Asanka A.
<definitions xmlns="http://ws.apache.org/ns/synapse"> <task class="org.apache.synapse.startup.tasks.MessageInjector" name="Tick"> <property name="to" value="urn:tick" /> <property name="soapAction" value="urn:tick" /> <property name="message"> <tick xmlns="http://mycom.com/ns/tick"> <s>IBM</s> <p>89.6</p> </tick> </property> <trigger interval="1" /> </task> <filter source="get-property('To')" regex="urn:tick"> <log level="custom"> <property name="Incomming msg" expression="get-property('To')" /> </log> <class name="org.sciflex.plugins.synapse.esper.mediators.AxiomMediator"> <property name="Configuration"> <esper-configuration> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.espertech.com/schema/esper" xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd"> <plugin-event-representation uri="type://xml/apacheaxiom/OMNode" class-name="com.espertech.esperio.representation.axiom.AxiomEventRepresentation" /> <plugin-event-type alias="Ticker"> <resolution-uri value="type://xml/apacheaxiom/OMNode" /> <initializer> <xml-axiom root-element-name="tick" default-namespace="http://mycom.com/ns/tick"> <namespace-prefix prefix="t" namespace="http://mycom.com/ns/tick" /> <xpath-property property-name="symbol" xpath="//t:tick/t:s" type="string" /> <xpath-property property-name="price" xpath="//t:tick/t:p" type="number" /> </xml-axiom> </initializer> </plugin-event-type> </esper-configuration> </property> <property name="statement" value="select * from Ticker.win:length_batch(10)" /> <property name="EventToAddress" value="urn:newevent" /> </class> <log level="custom"> <property name="Modified" expression="get-property('To')" /> </log> </filter> <filter source="get-property('To')" regex="urn:newevent"> <log level="full" /> </filter> </definitions>You should get a output on each 10 event as follows.