Hi Bathiyar,

Currently we don't have any Python clients to use with Siddhi TCP
transport. My Python skill is sparse but I can provide steps.
1. Create the json you want to send as a String. Json needs to comply to
following schema
{
    "event":{
        "my_key":WSO2,
        "my_value":55.6
    }
}
2. Convert String to byte[] with UTF-8 encoding
3. Send that byte[] as a stream to tcp socket. Your @source definition
should be corrected as per documentaion[1]
4. Also you need to add a query to consume this stream. Ex:
>From SampleStream#log()
select *
insert into tempStream;

Also please note that Siddhi has several other io extensions like HTTP,
JMS[2] that you can use. All extensions with prefix io are source/sink
extensions


[1] https://wso2-extensions.github.io/siddhi-io-tcp/api/2.0.15/
[2] https://wso2.github.io/siddhi/extensions/

THanks,
/Tishan

On Tue, Apr 17, 2018 at 4:00 PM, Bahtiyar KARANLIK <bahti...@karanlik.org>
wrote:

> Hi All,
>
> I’m facing a weird issue with sending JSON formatted events to a Siddhi
> TCP Source defined as below:
>
> @source(type = 'tcp',
>    @map(type = 'json', fail.on.missing.attribute = "false"))
> define stream SampleStram(my_key string, my_value double);
>
> I’ve created a Python client to send messages to this TCP socket but
> nothing happens (sample Python lines are as follows):
>
> host = '127.0.0.1'
> port = 9892
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect((host, port))
> s.sendall(my_values)
>
>
>  I just see the below line in the Siddhi app logs:
> [io.netty.util.ResourceLeakDetectorFactory] : Loaded default
> ResourceLeakDetector: io.netty.util.ResourceLeakDetector@7b7de0bb
>
> Any ideas are highly welcome.. (or any sample Python client ?)
>
> best regards..
>
> bahtiyar
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Tishan Dahanayakage
Associate Technical Lead
WSO2, Inc.
Mobile:+94 716481328

Disclaimer: This communication may contain privileged or other confidential
information and is intended exclusively for the addressee/s. If you are not
the intended recipient/s, or believe that you may have received this
communication in error, please reply to the sender indicating that fact and
delete the copy you received and in addition, you should not print, copy,
re-transmit, disseminate, or otherwise use the information contained in
this communication. Internet communications cannot be guaranteed to be
timely, secure, error or virus-free. The sender does not accept liability
for any errors or omissions.
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to