Hi César, First of all: welcome to the Hop community.
Usually we make a distinction between the connection metadata (hostname, port, username, password, and all sorts of other options). Implementing this is fairly easy. Take for example the source code of the Cassandra database <https://github.com/apache/incubator-hop/blob/master/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnection.java> connection metadata. In the same package you can find the code for the user interface ( CassandraConnectionEditor.java <https://github.com/apache/incubator-hop/blob/master/plugins/tech/cassandra/src/main/java/org/apache/hop/databases/cassandra/metadata/CassandraConnectionEditor.java>). Most of the user interface is generated automatically. Doing it like this will make a PLC4x connection a first class metadata citizen and show up in the metadata perspective for example. You'd also have direct access to the metadata widget in the plugin user interfaces. This makes the lives of the PLC4x users a lot easier. For the actual instantiation of a connection at runtime it's true that usually every transform has its own connection but this doesn't have to be the case. Transforms can store and retrieve runtime objects in the current pipeline using *IPipelineEngine.getExtensionDataMap()*. You do need to be careful about race conditions since all transforms start in parallel. Obviously you can also use a singleton design pattern in Java. Also note that this connection sharing would work for a local Hop execution engine but not for Beam where processing happens typically in a massively parallel fashion. While technically the pipelines would still work there would be no immediate way for the implementation to limit the number of connections. Please let us know if you need any help with the creation of PLC4x connectivity plugins themselves. We'd be happy to help out. Kind regard, Matt On Tue, Dec 14, 2021 at 4:12 PM Cesar Garcia <[email protected]> wrote: > Hi all, > > My name is Cesar Garcia, I am part of the Apache PLC4x team. > > I have been evaluating integrating the PLC4x communication libraries to the > HOP environment, but I have the following doubts: > > 1. It is possible to share a connection between all pipelines. > 2. In this aspect, it is correct to create the connection in an "Action" > and share it through "PluginRegistry.getInstance ()". > > The pattern of use is that each pipelines creates its connection to the > databases, in our type of application the connection to the devices is > limited, therefore they must share the resource. > > Grateful for your comments, > > Best regards, > > -- > *CEOS Automatización, C.A.* > *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,* > *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,* > > *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI* > *Ing. César García* > > *Cel: +58 414-760.98.95* > > *Hotline Técnica SIEMENS: 0800 1005080* > > *Email: [email protected] > <[email protected]>* > -- Neo4j Chief Solutions Architect *✉ *[email protected]
