how to push data from java class to Wso2 DAS - wso2

Is there any document or step by step process which guides us on how we can use WS02 DAS to pull data from java class objects and display reports using this data using WS02 Dashboards.
Any help would be really appreciated.

First You can create an Event Stream by specifying attributes and mention what are the attributes you need to persist. When events arrives to the streams, those will be stored in Events tables [1].
Then you can create an Event Receiver for that Event Stream [2]. When creating an event stream you can use a protocol such as Thrift, Soap, Http, Mqtt, JMS, Kafka and Web sockets. You can write a simple Java Application to publish data to DAS Receiver you created on message format protocol which you have selected. For an instance if you create SOAP receiver you can use data on soap message format and also if you create a HTTP receiver you can use JSON format.
You can create a dashboard and gadgets to visualize Event table which was created by your persistent stream [3]. Please note that this event table consist all the events WSO2 DAS received, you can process these data by using spark SQL [4] and create several streams which could be used in Analytics Dashboard.
[1]https://docs.wso2.com/display/DAS300/Understanding+Event+Streams+and+Event+Tables
[2] https://docs.wso2.com/display/DAS300/Configuring+Event+Receivers
[3] https://docs.wso2.com/display/DAS300/Analytics+Dashboard
[4] https://docs.wso2.com/display/DAS300/Batch+Analytics+Using+Spark+SQL

Your subject of the question and the body is contradictory. The subject says to push data while the body says pull data.
If push data is what you want to achieve, you can refer https://docs.wso2.com/pages/viewpage.action?pageId=45952633 This uses a thrift client to push data to DAS.
Please refer https://docs.wso2.com/display/DAS300/Analyzing+Data for how to analyze the raw data. You can write spark scripts for analyzing.
Finally you can https://docs.wso2.com/display/DAS300/Communicating+Results on how to analyze data. You may use the REST API exposed with DAS 3.0.0 to pull data from DAS.

Related

How to get RingCentral Live Reports data using the API?

When getting the call log data using below URL:
https://platform.ringcentral.com/restapi/v1.0/account/~/call-log?view=Simple&dateFrom='+Datetime.now().format('yyyy-MM-dd')+'&page=1&perPage=10000
This data is not matching with the inbound and outbound count in Live Reports.
Is any way there to get Live Reports data using an API call?
Live Reports provide graphical representations from some internal metrics and metadata and are totally independent system and not sure if it uses data from RingCentral call log.
The API you are using is of call log with parameters and it will be not same as Live Report data and will have some difference in both the output.
RingCentral Live Reports uses Call Session Notification (CSN) events as the underlying data for its metrics and so you can replicate the results by subscribing to the following CSN event filters:
[
"/restapi/v1.0/account/{accountId}/telephony/sessions",
"/restapi/v1.0/account/{accountId}/extension/~/telephony/sessions"
]
Read more here:
Account Telephony Sessions Event
Extension Telephony Sessions Event

Modify Metadata during Grpc Bidirectional Streaming in C++

Using Async bidirectional streaming, can i create a client stream (ClientAsyncReaderWriter) and modify metadata value in ClientContext for each request sent on that stream? Also, on the server side, can i use the ServerContext of the incoming client stream, to send modified metadata value for each response sent back to the client on the bidiriectional stream. Please let me know if there is a way to do this since i dont want to maintain multiple streams for each of the metadata value. I would like to use same stream and send different metadata value for a key for each request/response exchanged on that bidirectional stream.
This is intentionally not supported.
Metadata is intended to be at the RPC layer per bidi stream; not per req/response. If you wish to communicate information per req/response, you should put that inside the req/response.
Metadata is intended to be for all req/response in the same stream.
Metadata is tied to stream; please see documentation https://github.com/grpc/grpc/blob/master/CONCEPTS.md#abstract-grpc-protocol
There is the client interceptor
https://github.com/grpc/grpc/blob/master/include/grpcpp/impl/codegen/client_interceptor.h
which may be able to help
These tests show examples how the interceptors can be used:
https://github.com/grpc/grpc/blob/master/test/cpp/end2end/client_interceptors_end2end_test.cc

Howto override the event timestamp set by WSO2DAS

Currently WSO2 Data Analytic Server set the current timestamp to every event received using the available APIs. Is there a way to pass the timestamp value on the event data over the APIs in order to sent historical events to DAS?
From DAS 3.1.0 RC 1 onwards this can be achieved. You can follow the steps below to try it out.
Download DAS 3.1.0 RC1 from here.
Create an event stream with your payload and also add an attribute named _timestamp and set the attribute type as long.
Persist the Event selecting your payload attributes. (Please note that you will not be able to select the _timestamp attribute so leave it as it is)
Now simulate a event by providing your payload data along with the _timestamp epoch e.g - 1450206041000. The data explorer will show you an event received in 2015-12-16 00:30:41

How to use wso2cep in my case?

I am working with wso2cep3.0. I went through the docs of wso2cep but there is no exaplanation about wso2cep how would i use it
1.what is the use of Input Event Adapter:-in my concern for getting the data from client.
2.Event Builder means incoming data format specifier.
3.Event Formatter means Outgoing data format specifier.
4.Output Event Adapter out put handler.
but how can i use this thing means any program or any event writer most important how would i publish this to external world example as http endpoint or https or jms.
I am unable to understand how would i start and where can i start.
Please suggest me i know the ESB,DSS,IS,BPS
For a typical CEP usecase, you configure the input event adaptor to connect to an event source, such as a JMS endpoint, Thrift endpoint(WSO2Event adaptor in CEP 3.0.0) etc. Event builder specifies how the incoming message will be mapped.
Next the execution plans will have the actual query (the processing part) of the execution flow. This is where the CEP engine actually processes the events.
Event formatter formats it to an output format as needed. The output event adaptor connects to the actual endpoint to which the processed result would be published. It would go and publish to a JMS endpoint, email, database etc.
To get started, you need to create an input event adaptor, then an event builder that uses the input event adaptor, then the execution plan, then the output event adaptor, and an event formatter that would format the result from the execution plan and send to the relevant output adaptor. You can find the flow in [1].
You can find example configurations in /samples/artifacts directory. You can find an overview of samples in [2] and can find how to run them [3]. Each sample has an associated producer and a consumer that simulates real world event producers/consumers. Samples would be the best place to learn more about CEP configurations.
[1] http://docs.wso2.org/display/CEP300/CEP+Configuration+Overview
[2] http://docs.wso2.org/display/CEP300/Overview+of+Samples
[3] http://docs.wso2.org/display/CEP300/Setting+up+CEP+Samples

Distributed WSO2 CEP

If I have a distributed CEP setup with a JMS broker as the primary input.
Now if we tell our client application to send event to Topic X, the events will be distributed to each node in the CEP cluster, as each one will be listening on same Topic X.
Will this lead to duplication of results (lets say if I am counting certain data field, now since each node is receiving duplicate data, will my count be double of actual value if I have a 2 node cluster)
Can the CEP work off a JMS Queue instead of a Topic ? This way which ever node gets the event data first will consume the message off the Queue ? Does WSO2 CEP support JMS Queues ?
No, currently (CEP 2.0.1) does not have support to receive events from JMS queue.
But if this is your requirement then you can write your own CEP addeptor(broker) to receive events from a queue and push that to CEP.
To create a custom broker
Create an appropriate Broker Type by extending org.wso2.carbon.broker.core.BrokerType and an appropriate Broker Type Factory by extending the org.wso2.carbon.broker.core.BrokerTypeFactory from the jar org.wso2.carbon.broker.core-4.0.5.jar
Then to configure that broker with the CEP create a file called "broker.xml" at wso2cep-2.0.1/repository/conf
and add the following XML:
<brokerTypes xmlns="http://wso2.org/carbon/broker">
<brokerType class="<<class reference>>" /> ...
</brokerTypes>
Find a detail documentation on creating a custom broker at http://suhothayan.blogspot.com/2013/02/writing-custom-broker-for-wso2-cep.html