wso2 / product-sp

An open source, cloud-native streaming data integration and analytics product optimized for agile digital businesses
https://wso2.com/analytics-and-stream-processing/
Apache License 2.0
118 stars 132 forks source link

How widgets use mongodb #1063

Closed TwinsDestiny closed 4 years ago

TwinsDestiny commented 4 years ago

I changed mysql to mongodb.

EI_Analytics_StatApp.siddhi

@Store(type="mongodb",mongodb.uri="mongodb://10.10.8.23:27017/EI_ANALYTICS")
@Index('metaTenantId','messageFlowId')
define table ESBEventTable (metaTenantId int, messageFlowId string, host string, hashCode string, componentName string, componentType string, componentIndex int, componentId string, startTime long, endTime long, duration long, beforePayload string, afterPayload string, contextPropertyMap string, transportPropertyMap string, children string, entryPoint string, entryPointHashcode string, faultCount int, eventTimestamp long);

widgetConf.json

"providerConfig": {
      "configs" : {
        "type": "SiddhiStoreDataProvider",
        "config": {
          "siddhiApp": "@Store(type='mongodb',mongodb.uri='mongodb://10.10.8.23:27017/EI_ANALYTICS',collection.name='ESBEventTable') @Index('metaTenantId','messageFlowId') define table ESBEventTable(metaTenantId int, messageFlowId string, host string, hashCode string, componentName string, componentType string, componentIndex int, componentId string, startTime long, endTime long, duration long, beforePayload string, afterPayload string, contextPropertyMap string, transportPropertyMap string, children string, entryPoint string, entryPointHashcode string, faultCount int, eventTimestamp long);",
          "queryData": {
            "query": "from ESBEventTable on startTime>={{timeFrom}}L and startTime<{{timeTo}}L and metaTenantId=={{metaTenantId}} and componentType=='{{componentType}}' and {{componentIdentifier}}=='{{componentName}}' select messageFlowId,host,startTime, ifThenElse(faultCount>0,'Failed','Success') as faultCount order by startTime desc limit 100"
          },
          "publishingInterval": 60
        }
      }
    },

console log

[2020-03-18 15:10:13,085] ERROR {org.wso2.carbon.data.provider.endpoint.DataProviderEndPoint} - Error initializing the data provider endpoint for source type SiddhiStoreDataProvider. null org.wso2.siddhi.core.exception.StoreQueryCreationException
        at org.wso2.siddhi.core.SiddhiAppRuntime.getStoreQueryOutputAttributes(SiddhiAppRuntime.java:353)
        at org.wso2.siddhi.core.SiddhiAppRuntime.getStoreQueryOutputAttributes(SiddhiAppRuntime.java:326)
        at org.wso2.carbon.data.provider.siddhi.SiddhiProvider.init(SiddhiProvider.java:84)
        at org.wso2.carbon.data.provider.endpoint.DataProviderEndPoint.onMessage(DataProviderEndPoint.java:113)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.wso2.msf4j.internal.MSF4JWSConnectorListener.executeMethod(MSF4JWSConnectorListener.java:360)
        at org.wso2.msf4j.internal.MSF4JWSConnectorListener.lambda$handleTextWebSocketMessage$61(MSF4JWSConnectorListener.java:196)
        at java.util.Optional.ifPresent(Optional.java:159)
        at org.wso2.msf4j.internal.MSF4JWSConnectorListener.handleTextWebSocketMessage(MSF4JWSConnectorListener.java:177)
        at org.wso2.msf4j.internal.MSF4JWSConnectorListener.onMessage(MSF4JWSConnectorListener.java:85)
        at org.wso2.transport.http.netty.contractimpl.websocket.DefaultWebSocketConnectorFuture.notifyWebSocketListener(DefaultWebSocketConnectorFuture.java:52)
        at org.wso2.transport.http.netty.contractimpl.websocket.WebSocketInboundFrameHandler.notifyTextMessage(WebSocketInboundFrameHandler.java:207)
        at org.wso2.transport.http.netty.contractimpl.websocket.WebSocketInboundFrameHandler.channelRead(WebSocketInboundFrameHandler.java:157)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at org.wso2.transport.http.netty.contractimpl.listener.UriAndHeaderLengthValidator.channelRead(UriAndHeaderLengthValidator.java:68)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at io.netty.handler.codec.http.websocketx.Utf8FrameValidator.channelRead(Utf8FrameValidator.java:77)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1380)
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1159)
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1194)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1476)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1474)
        at org.wso2.extension.siddhi.store.mongodb.MongoExpressionVisitor.getCompiledCondition(MongoExpressionVisitor.java:53)
        at org.wso2.extension.siddhi.store.mongodb.MongoDBEventTable.compileCondition(MongoDBEventTable.java:553)
        at org.wso2.siddhi.core.table.record.AbstractRecordTable.compileCondition(AbstractRecordTable.java:358)
        at org.wso2.siddhi.core.util.parser.StoreQueryParser.constructRegularStoreQueryRuntime(StoreQueryParser.java:362)
        at org.wso2.siddhi.core.util.parser.StoreQueryParser.constructStoreQueryRuntime(StoreQueryParser.java:303)
        at org.wso2.siddhi.core.util.parser.StoreQueryParser.parse(StoreQueryParser.java:148)
        at org.wso2.siddhi.core.SiddhiAppRuntime.getStoreQueryOutputAttributes(SiddhiAppRuntime.java:341)
        ... 58 more

[2020-03-18 15:10:13,087] ERROR {org.wso2.carbon.data.provider.endpoint.DataProviderEndPoint} - Error found in method : org.wso2.siddhi.core.exception.StoreQueryCreationException
TwinsDestiny commented 4 years ago

@pcnfernando