如何通过rest-api发布类型为long的属性的BAM事件?

时间:2012-08-23 12:15:43

标签: wso2 wso2bam

根据日志,我设法使用rest-api创建事件流定义。

[2012-08-22 08:48:57,287]  INFO {org.wso2.carbon.databridge.streamdefn.cassandra.datastore.CassandraConnector} -  Saving Stream Definition : StreamDefinition{streamId='labit.stream-0.0.3-67a2ed14-ece6-4d98-a904-0dde7892c3a9', name='labit.stream', version='0.0.3', nickName='null', description='LONG and BigINT Test stream', tags=null, metaData=[Attribute{name='myTimeStamp', type=LONG}, Attribute{name='source', type=STRING}], correlationData=null, payloadData=[Attribute{name='fibonacciNumber', type=INT}]}

但是当我尝试发布活动时..

[
    {
    "payloadData" : [1] ,
    "metaData" : [1340279541606, "labittest"]
    }
]  

..使用rest-api,它会引发异常。

[2012-08-22 08:51:48,797] ERROR {org.wso2.carbon.databridge.streamdefn.cassandra.subscriber.BAMEventSubscriber} -  Error processing event. 
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Long
at org.wso2.carbon.databridge.streamdefn.cassandra.inserter.LongInserter.addDataToBatchInsertion(LongInserter.java:31)
at org.wso2.carbon.databridge.streamdefn.cassandra.datastore.CassandraConnector.prepareDataForInsertion(CassandraConnector.java:690)
at org.wso2.carbon.databridge.streamdefn.cassandra.datastore.CassandraConnector.insertEventList(CassandraConnector.java:489)
at org.wso2.carbon.databridge.streamdefn.cassandra.subscriber.BAMEventSubscriber.receive(BAMEventSubscriber.java:41)
at org.wso2.carbon.databridge.core.internal.queue.QueueWorker.run(QueueWorker.java:64)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

另一方面,我可以从Java代码向同一个流发布一个事件。

dataPublisher.publish(labitStream, new Object[] { 1340279541606L, "labittest" }, null, new Object[] { 1 });

我使用的WSO2 BAM2版本是从wso2bam-2.0.0-BETA.zip中提取的版本。

所以问题是:如何使用rest-api发布具有long类型属性的事件?

1 个答案:

答案 0 :(得分:0)

修复此问题的beta2托管在product download page