Hi Andres,

I think there is an issue with the json parser. We are using
com.jayway.jsonpath as our json parser for CEP. I think there is a known
issue for Long type when converting, Please see the link [1].. We also
using version 0.8.1 com.jayway.jsonpath. We'll go through this further to
find a possible solution and fix it.. Thanks for reporting..

[1] http://www.pressingquestion.com/4945250/Jsonpath---Read-Java-Long-Type

Regards,
Mohan


On Thu, Nov 21, 2013 at 10:49 PM, andresgomez92 <andresgome...@gmail.com>wrote:

> Hi all,
>
> I have a problem when I try to parse java.lang.Long.
>
> For example:
>
> I send to CEP this json event:
>
> *{"timestamp":1383580897,"sensor_id":0,"sensor_name":"pablo06"}
>
> where:
>   * timestamp is a Long.
>   * sensor_id is an Integer.
>   * Sensor_name is a String.*
>
> My eventBuilder is like this:
>
> *<?xml version="1.0" encoding="UTF-8"?>
> <eventBuilder name="builder_rb_monitor" statistics="enable"
>     trace="disable" xmlns="http://wso2.org/carbon/eventbuilder";>
>     <from eventAdaptorName="wso2KafkaConsumer"
> eventAdaptorType="kafkaConsumerBroker">
>         <property name="topic">rb_monitor</property>
>     </from>
>     <mapping customMapping="enable" type="json">
>         <property>
>             <from jsonPath="$.timestamp"/>
>             <to default="-1" name="timestamp" type="long"/>
>         </property>
>         <property>
>             <from jsonPath="$.sensor_id"/>
>             <to default="-1" name="sensor_id" type="int"/>
>         </property>
>         <property>
>             <from jsonPath="$.sensor_name"/>
>             <to default="none" name="sensor_name" type="string"/>
>         </property>
>     </mapping>
>     <to streamName="rb_monitor_stream" version="1.0.0"/>
> </eventBuilder>*
>
> and my eventStream is like this:
>
> *<streamDefinition name="rb_monitor_stream" version="1.0.0">
>         <payloadData>
>                 <property name="timestamp" type="LONG" />
>                 <property name="sensor_id" type="INT" />
>                 <property name="sensor_name" type="STRING" />
>         </payloadData>
> </streamDefinition>*
>
> But when I send eventJson in the terminal I can see this:
>
> *"[2013-11-20 19:54:51,382]  WARN - {JsonInputMapper}  Unable to cast the
> input data to required type :java.lang.Long"*
>
> and in the eventTracer I can see:
>
> *19:53:08,286 [-] [pool-12-thread-1]  INFO TenantId=-1234 : Event Builder :
> builder_rb_monitor, before processing
> {"timestamp":1383580897,"sensor_id":0,"sensor_name":"pablo06"}
>
> 19:53:08,287 [-] [pool-12-thread-1]  INFO TenantId=-1234 : Event Builder :
> builder_rb_monitor : Event Stream : rb_monitor_stream:1.0.0 , after
> processing
> [0, pablo06]*
>
> Does anyone know why this happens?
>
> Regards and thanks!
>
> Andrés Gómez
>
>
>
> --
> View this message in context:
> http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-parser-java-lang-Long-Problem-CEP-tp88734.html
> Sent from the WSO2 Development mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>



-- 
*V. Mohanadarshan*
*Software Engineer,*
*Data Technologies Team,*
*WSO2, Inc. http://wso2.com <http://wso2.com> *
*lean.enterprise.middleware.*

email: mo...@wso2.com
phone:(+94) 771117673
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to