Hi Suho,

You can find the python version of test case written using Pyjnius in below
link.
https://github.com/madhawav/CEP-Python-Wraps/tree/master/Pyjnius%20Prototype%20Wrap
Instructions on building the code is also given their.

During development, I noticed following disadvantages of Pyjnius API

   - Not compatible with Python 3.x.
   - There are no stable releases. However, the code available in master
   branch is relatively stable.
   - Difficult to configure. It is required to develop the library from
   source. This would make it difficult to distribute an API developed on
   Pyjnius.
   - There are no evidence that a proper release would be done soon.

However, Pyjnius supports callback of events from Java to Python.
Additionally, it is easier to develop using Pyjnius ones it is configured.

So, I had a looked at some of the other options as well.

Java Bridge

*Advantages*

   - Has stable releases available through Python Package Index. (pip)

*Disadvantages*

   - No direct call-back mechanism to receive events from Java side. It is
   possible to execute Python scripts in Java  but those scripts would not be
   in same context as Python Host App.
   - Comparatively harder to develop on but it is manageable.

Py4J

The main difference in Py4J is that it uses socket connections to
communicate with JVM instead of JNI. (secured socket connections are
possible).

*Advantages*

   - Stable release available through Python Package Index (pip). Easy to
   configure.
   - Can connect to an already running Java application (with Py4J) and
   communicate with it. (Thus, can be used to communicate with a running
   instance of WSO2 CEP)
   - Supports callback events.
   - Well maintained documentation. Active project.

*Disadvantages*

   - Would require a work-around to avoid clashing between socket
   connection ports when concurrent applications use the API.

As of now, I feel Py4J is the most suitable option. However, I am yet to
look at some other options available such as JPy and JCC.

Regards,

Madhawa

On Wed, Mar 15, 2017 at 11:10 PM, Sriskandarajah Suhothayan <s...@wso2.com>
wrote:

> Great, do also start working on writing the project proposal.
>
> Regards
> Suho
>
> On Wed, Mar 15, 2017 at 10:58 PM, Madhawa Vidanapathirana <
> madhawavidanapathir...@gmail.com> wrote:
>
>> Hi Suho,
>> Progress made so far is managed to write a python version of test case
>> you suggested using Pyjnius [1] [2].
>> Pyjnius is capable of handling method calls and callbacks to/from JAVA
>> via JNI.
>>
>> I will send the code here after I properly arrange it into a prototype
>> API.
>>
>> [1] - https://pyjnius.readthedocs.io/en/latest/index.html
>> [2] - https://github.com/kivy/pyjnius/blob/master/docs/source/index.rst
>>
>> Regards,
>> Madhawa
>>
>> On Wed, Mar 15, 2017 at 1:11 AM, Sriskandarajah Suhothayan <s...@wso2.com
>> > wrote:
>>
>>> As the first step focus on building APIs such that we can write the
>>> following test case[1] in python.
>>>
>>> [1]https://github.com/wso2/siddhi/blob/master/modules/siddhi
>>> -samples/quick-start-samples/src/main/java/org/wso2/siddhi/s
>>> ample/SimpleFilterSample.java
>>>
>>> Regards
>>> Suho
>>>
>>> On Tue, Mar 14, 2017 at 9:55 AM, Madhawa Vidanapathirana <
>>> madhawavidanapathir...@gmail.com> wrote:
>>>
>>>> Hi,
>>>> Thank you for your quick reply.
>>>>
>>>> Since directly using Siddhi Library is the more general case, I'll
>>>> first focus on it.
>>>>
>>>> 1) I am thinking about following the same structure in JAVA API,
>>>> centered around Siddhi Manager. Any opinions on this?
>>>> 2) Any idea on extent to which lower level/internal components should
>>>> be exposed? (e.g. - Exposing "StreamDefinition" class in addition to
>>>> creating stream via Siddhi query using 
>>>> "siddhiManager.createExecutionPlanRuntime").
>>>> I have heard that it is usually discouraged to use lower level components
>>>> instead of the query approach.
>>>>
>>>> Will try to send you a prototype covering basic functionality through
>>>> Siddhi Java API, before making the proposal for entire project.
>>>>
>>>> Madhawa
>>>>
>>>> On Mon, Mar 13, 2017 at 9:53 PM, Sriskandarajah Suhothayan <
>>>> s...@wso2.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Sun, Mar 12, 2017 at 12:37 PM, Madhawa Vidanapathirana <
>>>>> madhawavidanapathir...@gmail.com> wrote:
>>>>>
>>>>>> Hi.
>>>>>>
>>>>>> I am an undergraduate from Department of Computer Science and
>>>>>> Engineering, University of Moratuwa. I recently completed my internship 
>>>>>> at
>>>>>> WSO2 working with the Support Team on the project WSO2 Support Knowledge
>>>>>> Base.
>>>>>>
>>>>>> I am interested on GSOC Project* "Proposal 16: Python API for Siddhi
>>>>>> CEP"*. My internship project at WSO2 was almost entirely done using
>>>>>> Python. Additionally, I used Py4J Framework to interface certain parts of
>>>>>> the project to JAVA APIs. Furthermore, I have a certain amount of 
>>>>>> exposure
>>>>>> with Siddhi/CEP through the WHACK project I took part.
>>>>>>
>>>>>> I went through the provided details in WSO2 GSOC 2017 Project List
>>>>>> page and I am interested to know some more details.
>>>>>>
>>>>>>    1. What version of CEP/Siddhi should be used by the API?
>>>>>>
>>>>>> You need to support the latest released version of Siddhi and DAS
>>>>> which is in DAS 3.1 and also for the latest Siddhi (4.0)
>>>>>
>>>>>>
>>>>>>    1. In the description, does "Service APIs" refer to "Admin
>>>>>>    Services API" which is usually used by Admin Panel to communicate 
>>>>>> with CEP?
>>>>>>
>>>>>> Yes, to deploy the queries and to send and receive events
>>>>>
>>>>>>
>>>>>>    1. Should the Siddhi Python API require WSO2 CEP to be running in
>>>>>>    order to make Python API usable?
>>>>>>
>>>>>> Not necessay it should both work with the running CEP/DAS and use
>>>>> Siddhi library in the ohter cases.
>>>>>
>>>>>>
>>>>>>    1. Is the Python API expected to do configuring of Siddhi CEP,
>>>>>>    streaming events to/from Siddhi CEP, or both?
>>>>>>
>>>>>> Yes in terms of queries.
>>>>>
>>>>>
>>>>>
>>>>>> Thank You
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Madhawa Vidanapathirana*
>>>>>> Student
>>>>>> Department of Computer Science and Engineering
>>>>>> University of Moratuwa
>>>>>> Sri Lanka
>>>>>>
>>>>>> Mobile: (+94) 716874425 <071%20687%204425>
>>>>>> Email: madhawavidanapathir...@gmail.com
>>>>>> Linked-In: https://lk.linkedin.com/in/madhawa-vidanapathirana-3430b94
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> *S. Suhothayan*
>>>>> Associate Director / Architect & Team Lead of WSO2 Complex Event
>>>>> Processor
>>>>> *WSO2 Inc. *http://wso2.com
>>>>> * <http://wso2.com/>*
>>>>> lean . enterprise . middleware
>>>>>
>>>>>
>>>>> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog:
>>>>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter:
>>>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in:
>>>>> http://lk.linkedin.com/in/suhothayan 
>>>>> <http://lk.linkedin.com/in/suhothayan>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Madhawa Vidanapathirana*
>>>> Student
>>>> Department of Computer Science and Engineering
>>>> University of Moratuwa
>>>> Sri Lanka
>>>>
>>>> Mobile: (+94) 716874425 <071%20687%204425>
>>>> Email: madhawavidanapathir...@gmail.com
>>>> Linked-In: https://lk.linkedin.com/in/madhawa-vidanapathirana-3430b94
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> *S. Suhothayan*
>>> Associate Director / Architect & Team Lead of WSO2 Complex Event
>>> Processor
>>> *WSO2 Inc. *http://wso2.com
>>> * <http://wso2.com/>*
>>> lean . enterprise . middleware
>>>
>>>
>>> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog:
>>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter:
>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in:
>>> http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
>>>
>>
>>
>>
>> --
>> *Madhawa Vidanapathirana*
>> Student
>> Department of Computer Science and Engineering
>> University of Moratuwa
>> Sri Lanka
>>
>> Mobile: (+94) 716874425 <071%20687%204425>
>> Email: madhawavidanapathir...@gmail.com
>> Linked-In: https://lk.linkedin.com/in/madhawa-vidanapathirana-3430b94
>>
>
>
>
> --
>
> *S. Suhothayan*
> Associate Director / Architect & Team Lead of WSO2 Complex Event Processor
> *WSO2 Inc. *http://wso2.com
> * <http://wso2.com/>*
> lean . enterprise . middleware
>
>
> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog:
> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter:
> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in:
> http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
>



-- 
*Madhawa Vidanapathirana*
Student
Department of Computer Science and Engineering
University of Moratuwa
Sri Lanka

Mobile: (+94) 716874425
Email: madhawavidanapathir...@gmail.com
Linked-In: https://lk.linkedin.com/in/madhawa-vidanapathirana-3430b94
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to