Re: Kafka Connect Integration

2018-08-28 Thread Julian Feinauer
Hey Sagar,

hey Chris,



I want to join your discussion for part b3 as this is something we usually 
require.

We use a module we call the plc-scraper for that task (the term scraping in 
that content is borrowed from Prometheus where it is used extensively in this 
context [1]).

Generally speaking the scraper takes a config containing addresses, addresses 
and scrape rates and runs than as daemon and pushes the scrape results 
downstream (usually Kafka but we also use other "Queues").



As we are currently rewriting this scraper I already considered donating it to 
plc4x in the form of an example or perhaps even as a standalone module.



So I agree with Chris that this should not be part of the PlcDriver Level but 
rather on another layer "on top" and I would be more interested in the 
specification of a "line protocol" which describes how message are serialized 
for Kafka (or other sources).

Can we come up with a common "schema" which fits many use cases?



Our messages contain the following informations:

- timestamp

- source

- values

- additional tags



Best 

Julian



[1] https://prometheus.io/docs/prometheus/latest/getting_started/



Am 28.08.18, 22:53 schrieb "Christofer Dutz" :



Hi Sagar,



sorry for not responding ... your mail must have skipped my eye ... sorry 
for that.



a) PLC4X works exactly the same way ... it consists of plc4x-core, which 
only contains the DriverManager and plc4x-api which contains the API clases. So 
with these two jars you can build a full PLC4X application.

In order to connect to a PLC you need to add the jar containing the 
required driver to the classpath.



b) Well if using something other than the connection url as partition key 
as partition key, it is possible that multiple kafka connect nodes would 
connect to the same PLC. In that case it could be a problem to control the 
order. I guess using the timestamp when receiving a response (Probably 
generated by the KC plc4x driver) could be a valid approach.



b2) Regarding the infinite loop ... I think we won't need such a mechanism. 
If we think of a set of fields from a PLC, we can think of a PLC as a one-row 
database table. Producing diffs should be a lot simpler that way.



b3) Regarding push events ... PLC4X has a subscription mode next to the 
polling. So it would be possible to also define PLC4X datasources that actively 
push events to kafka ... I have to admit that this would be the mode I would 
prefer most. But as not all protocols and PLCs support this mode, I think it 
would be safest to use polling and to add push support after that.



Regarding different languages: Currently we are concentrating mainly on the 
Java implementation as it's the biggest challenge to understand and implement 
the protocols. Porting them to other languages (especially C and C++) shouldn't 
be as hard as implementing the first version. But that's currently a base 
uncovered as we don't have the resources to implement all of them at once.



And there are no stupid questions :-)



Hope I could answer all of yours. If not, just ask and I'll probably not 
miss that one ;-)



Chris





Am 23.08.18, 19:52 schrieb "Sagar" :



Hi Chirstofer,



Thanks for the detailed responses. I would like to ask a couple of more

questions(which may be borderline naive or stupid :D ).



First thing that I would like to know- ignore my lack of knowledge on 
PLCs-

but from what I understand are devices which are small devices used to

execute program instructions. These would have very small memory 
footprints

as well I believe? Also, when you say the Siemens one can handle 20

connections, would it be from different devices connecting to it? The

reason I ask these questions are these ->



a) The way the kafka-connect framework is executed is by installing the

whole framework with all the relevant jars needed on the classpath. So, 
if

you talk about the JDBC connector for K-Connect, it would need the mysql

driver jar(for example) and other jars needed to support the framework. 
If

we say choose to use avro, then we would need more jars to support that.

Would we be able to install all that?



b) Also, if multiple devices do connect to it, then won't we have events

arriving out of order from them? Does the ordering matter amongst events

that are being pushed?



Regarding the infinite loop question, the reason JDBC connector uses 
that

is that it creates tasks for a given table and fires queries to find

deltas. So, if the polling frequency is 2 seconds, and it last ran on

12.00.00 then it would run at 12.00.02 to figure out what changed in 
that

time frame. So, the way PlcReaders read() 

Re: Making your first release

2018-08-28 Thread Niclas Hedhman
I agree with Justin and Juliana and would suggest;  Spend some time to get
the release process automated and smooth, then start a 0.x release train,
with no compatibility guarantees.

On Sun, Aug 26, 2018 at 5:29 PM, Julian Feinauer <
j.feina...@pragmaticminds.de> wrote:

> Hi Justin,
>
>
>
> I like your suggestion and also wanted to suggest a first release soon as
> we start to experiment with plc4j a lot in one project and I don’t like to
> reference snapshots with the lot of changes going on (or are planned).
>
> What do the others think of this?
>
>
>
> Julian
>
>
>
> Am 26.08.18, 02:22 schrieb "Justin Mclean" :
>
>
>
> Hi,
>
>
>
> While looking through the incubator reports it’s come to my attention
> that this podling hasn’t made a release yet and has been in the incubator
> for 250+ days.  "Release early and release often” should be the guideline
> to follow. What is holding up this project making it first release?
> Remember a first release doesn’t have to be perfect and each release just
> needs to be better than the last.
>
>
>
> Thanks,
>
> Justin
>
>
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java


Re: ASF Slack

2018-08-28 Thread Justin Mclean
I could be mistaken but I think anyone can join or be invited

On Wed., 29 Aug. 2018, 8:41 am Julian Feinauer, <
j.feina...@pragmaticminds.de> wrote:

> Hi Benedikt,
>
>
>
> I think ist a good idea to have a slack for communication but I agree that
> its a bit inelegant to require an apache email as many interested people or
> (new) participants won't have one (I for example have none).
>
>
>
> Julian
>
>
>
> Am 28.08.18, 15:02 schrieb "Benedikt Ritter" :
>
>
>
> Hi!
>
>
>
> I've created #plc4x over at the-asf.slack.com You need an Apache
> E-Mail to
>
> register, so it's probably not the best channel to discuss things.
>
>
>
> Regards,
>
> Benedikt
>
>
>
>
>


Re: ASF Slack

2018-08-28 Thread Julian Feinauer
Hi Benedikt,



I think ist a good idea to have a slack for communication but I agree that its 
a bit inelegant to require an apache email as many interested people or (new) 
participants won't have one (I for example have none).



Julian



Am 28.08.18, 15:02 schrieb "Benedikt Ritter" :



Hi!



I've created #plc4x over at the-asf.slack.com You need an Apache E-Mail to

register, so it's probably not the best channel to discuss things.



Regards,

Benedikt






Re: Kafka Connect Integration

2018-08-28 Thread Christofer Dutz
Hi Sagar,

sorry for not responding ... your mail must have skipped my eye ... sorry for 
that.

a) PLC4X works exactly the same way ... it consists of plc4x-core, which only 
contains the DriverManager and plc4x-api which contains the API clases. So with 
these two jars you can build a full PLC4X application.
In order to connect to a PLC you need to add the jar containing the required 
driver to the classpath.

b) Well if using something other than the connection url as partition key as 
partition key, it is possible that multiple kafka connect nodes would connect 
to the same PLC. In that case it could be a problem to control the order. I 
guess using the timestamp when receiving a response (Probably generated by the 
KC plc4x driver) could be a valid approach.

b2) Regarding the infinite loop ... I think we won't need such a mechanism. If 
we think of a set of fields from a PLC, we can think of a PLC as a one-row 
database table. Producing diffs should be a lot simpler that way.

b3) Regarding push events ... PLC4X has a subscription mode next to the 
polling. So it would be possible to also define PLC4X datasources that actively 
push events to kafka ... I have to admit that this would be the mode I would 
prefer most. But as not all protocols and PLCs support this mode, I think it 
would be safest to use polling and to add push support after that.

Regarding different languages: Currently we are concentrating mainly on the 
Java implementation as it's the biggest challenge to understand and implement 
the protocols. Porting them to other languages (especially C and C++) shouldn't 
be as hard as implementing the first version. But that's currently a base 
uncovered as we don't have the resources to implement all of them at once.

And there are no stupid questions :-)

Hope I could answer all of yours. If not, just ask and I'll probably not miss 
that one ;-)

Chris


Am 23.08.18, 19:52 schrieb "Sagar" :

Hi Chirstofer,

Thanks for the detailed responses. I would like to ask a couple of more
questions(which may be borderline naive or stupid :D ).

First thing that I would like to know- ignore my lack of knowledge on PLCs-
but from what I understand are devices which are small devices used to
execute program instructions. These would have very small memory footprints
as well I believe? Also, when you say the Siemens one can handle 20
connections, would it be from different devices connecting to it? The
reason I ask these questions are these ->

a) The way the kafka-connect framework is executed is by installing the
whole framework with all the relevant jars needed on the classpath. So, if
you talk about the JDBC connector for K-Connect, it would need the mysql
driver jar(for example) and other jars needed to support the framework. If
we say choose to use avro, then we would need more jars to support that.
Would we be able to install all that?

b) Also, if multiple devices do connect to it, then won't we have events
arriving out of order from them? Does the ordering matter amongst events
that are being pushed?

Regarding the infinite loop question, the reason JDBC connector uses that
is that it creates tasks for a given table and fires queries to find
deltas. So, if the polling frequency is 2 seconds, and it last ran on
12.00.00 then it would run at 12.00.02 to figure out what changed in that
time frame. So, the way PlcReaders read() runs, would it keep returning
newer data?

We can skip over the rest of the parts, but looking at parts a and b above,
would it make sense to have something like a kafka-connect framework for
pushing data to Kafka? Also, from the github link, the drivers are to be
supported in 3 languages as well. How would that play out?

Again- apologies if the questions seem stupid.

Thanks!
Sagar.

On Wed, Aug 22, 2018 at 10:39 PM Christofer Dutz 
wrote:

> Hi Sagar,
>
> great that you managed to have a look ... I'll try to answer your
> questions.
> (I like to answer them postfix as whenever emails are sort of answered
> in-line, they are extremely hard to read and follow on mobile email 
clients
> __ )
>
> First of all I created the original plugin via the archetype for
> kafka-connect plugins. The next thing I did, was to have a look at the 
code
> of the JDBC Kafka Connect plugin (as you might have guessed) as I thought
> that it would have similar structure as we do. Unfortunately I think the
> JDBC plugin is far more complex than the plc4x connector will have to be. 
I
> sort of picked some of the things I liked with the archetype and some I
> liked with the jdbc ... if there was a third, even cooler option ... I 
will
> definitely have missed that. So if you think there is a thing worth
> changing ... you can change anything you like.
>

Re: Kafka Connect Integration

2018-08-28 Thread Sagar
Hi Christofer,

Just thought I will remind you with this one. There's no rush from my side
but I see you're caught up with a lot of things so sending a reminder :)

Thanks!
Sagar.

On Thu, Aug 23, 2018 at 11:22 PM Sagar  wrote:

> Hi Chirstofer,
>
> Thanks for the detailed responses. I would like to ask a couple of more
> questions(which may be borderline naive or stupid :D ).
>
> First thing that I would like to know- ignore my lack of knowledge on
> PLCs- but from what I understand are devices which are small devices used
> to execute program instructions. These would have very small memory
> footprints as well I believe? Also, when you say the Siemens one can handle
> 20 connections, would it be from different devices connecting to it? The
> reason I ask these questions are these ->
>
> a) The way the kafka-connect framework is executed is by installing the
> whole framework with all the relevant jars needed on the classpath. So, if
> you talk about the JDBC connector for K-Connect, it would need the mysql
> driver jar(for example) and other jars needed to support the framework. If
> we say choose to use avro, then we would need more jars to support that.
> Would we be able to install all that?
>
> b) Also, if multiple devices do connect to it, then won't we have events
> arriving out of order from them? Does the ordering matter amongst events
> that are being pushed?
>
> Regarding the infinite loop question, the reason JDBC connector uses that
> is that it creates tasks for a given table and fires queries to find
> deltas. So, if the polling frequency is 2 seconds, and it last ran on
> 12.00.00 then it would run at 12.00.02 to figure out what changed in that
> time frame. So, the way PlcReaders read() runs, would it keep returning
> newer data?
>
> We can skip over the rest of the parts, but looking at parts a and b
> above, would it make sense to have something like a kafka-connect framework
> for pushing data to Kafka? Also, from the github link, the drivers are to
> be supported in 3 languages as well. How would that play out?
>
> Again- apologies if the questions seem stupid.
>
> Thanks!
> Sagar.
>
> On Wed, Aug 22, 2018 at 10:39 PM Christofer Dutz <
> christofer.d...@c-ware.de> wrote:
>
>> Hi Sagar,
>>
>> great that you managed to have a look ... I'll try to answer your
>> questions.
>> (I like to answer them postfix as whenever emails are sort of answered
>> in-line, they are extremely hard to read and follow on mobile email clients
>> __ )
>>
>> First of all I created the original plugin via the archetype for
>> kafka-connect plugins. The next thing I did, was to have a look at the code
>> of the JDBC Kafka Connect plugin (as you might have guessed) as I thought
>> that it would have similar structure as we do. Unfortunately I think the
>> JDBC plugin is far more complex than the plc4x connector will have to be. I
>> sort of picked some of the things I liked with the archetype and some I
>> liked with the jdbc ... if there was a third, even cooler option ... I will
>> definitely have missed that. So if you think there is a thing worth
>> changing ... you can change anything you like.
>>
>> 1)
>> The code of the jdbc plugin showed such a while(true) loop, however I
>> think this was because the jdbc query could return a lot of rows and hereby
>> Kafka events. In our case we have one request and get one response. The
>> code in my example directly calls "get()" on the request and is hereby
>> blocking. I don't know if this is good, but from reading the jdbc example,
>> this should be blocking too ...
>> So the PlcReaders read() method returns a completable future ... this
>> could be completed asynchronously and the callback could fire the kafka
>> events, but I didn't know if this was ok with kafka. If it is possible,
>> please have a look at this example code:
>> https://github.com/apache/incubator-plc4x/blob/master/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/S7PlcReaderSample.java
>> It demonstrates with comments the different usage types.
>>
>> While at it ... is there also an option for a Kafka connector that is
>> able to push data? So if an incoming event arrives, this is automatically
>> pushed without a fixed polling interval?
>>
>> 2)
>> I have absolutely no idea as I am not quite familiar with the concepts
>> inside kafka. What I do know is that probably the partition-key should be
>> based upon the connection url. The problem is, that with kafka I could have
>> 1000 nodes connecting to one PLC. While Kafka wouldn't have problems with
>> that, the PLCs have very limited resources. So as far as I decoded the
>> responses of my Siemens S7 1200 it can handle up to 20 connections (Usually
>> a control-system already consuming 2-3 of them) ... I think it would be
>> ideal, if on one Kafka node (or partition) there would be one PlcConnection
>> ... this connection should then be shared among all requests to a PLC with
>> a shared connection url (I hope I'm not writing 

[GitHub] pisquaredover6 opened a new pull request #13: Basic example to connect S7 device to Google Cloud IoT Core

2018-08-28 Thread GitBox
pisquaredover6 opened a new pull request #13: Basic example to connect S7 
device to Google Cloud IoT Core
URL: https://github.com/apache/incubator-plc4x/pull/13
 
 
   Implement basic example of connecting a S7 device to Google Cloud IoT Core


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


Re: API Changes proposal

2018-08-28 Thread Christofer Dutz
Hi all,

I just pushed changes to my API refactoring branch ... so far I only adjusted 
the API module and added an example using the changed API.
To have a look, please go to [1] ...

General changes I implemented while working on the refactoring itself. I did 
notice, that my current proposal "chris-2" did 

Having to inject the type conversion code would have made it necessary to 
inject a converter which didn't feel right. So I changed the API to be purely 
interface based.
In order to be able to construct these objects I also added builders for them. 

I asked a few people here what they think, and most liked the simplicity and 
didn't have any WTF experiences (Which seems to be a good thing as I did have 
to explain a lot with the current API)

Quick Feedback highly appreciated as I will start implementing 
DefaultPlcReadRequest & Co (in driver-base ... together with the builders) 
after that I'll start migrating the drivers. 
Right now having a look a named example [1] would be a good start ... 
Second would be a deeper look into the API module [2].

Would be a shame to waste that time and effort if you think the changes suck 
(or are less than optimal as non-Germans would probably call them ;-) ) .

Chris

[1] 
https://github.com/apache/incubator-plc4x/blob/feature/api-redesign-chris-c/examples/hello-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
[2] 
https://github.com/apache/incubator-plc4x/tree/feature/api-redesign-chris-c/plc4j/api


Am 27.08.18, 09:57 schrieb "Christofer Dutz" :

Ups ... after reloading .. I just saw Julians Proposal pop up ... haven't 
looked into that ...
Will do that right away.

Chris

Am 25.08.18, 15:52 schrieb "Christofer Dutz" :

Hi Julian,

version 2 should now be quite different ... I started reworking my 
original proposal and decided to revert that an start a second proposal.
My first did address some parts needing cleaning up, but I still wasn't 
quite satisfied with it. So I did another more radical refactoring.

If you reload the second there should be a lot of differences.

I just hit "save" a few minutes ago however ... but now I'm quite happy 
with it. So please have another look at the second proposal. 

And please, maybe add your own proposal ... my versions are just 
Brainstorming from my side.

My favorite is currently "Chris' Proposal 2" ;-)

Chris