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
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to