Hi,

This is quite an interesting problem, as they point out, the state machine
of the driver (plc4x) and the state of the Netty pipe must be handled,

For the S7 driver, I have the S7HA version (high availability) in which I
solve part of that problem and it may help you. You can see it in [1].

I hope to be able to place this version this week in the plc4x repo since
it will be the one I will use for my tests, but I see the solution that you
propose as interesting and on track.

My grain of sand,

Kind regards,

1. https://github.com/glcj/plc4x/tree/develop/plc4j/drivers/s7



El lun, 27 feb 2023 a las 11:11, splatch (via GitHub) (<g...@apache.org>)
escribió:

>
> splatch commented on code in PR #822:
> URL: https://github.com/apache/plc4x/pull/822#discussion_r1118881055
>
>
> ##########
> plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xNettyWrapper.java:
> ##########
> @@ -200,85 +198,60 @@ public void userEventTriggered(ChannelHandlerContext
> ctx, Object evt) throws Exc
>          // by sending a connection request to the plc.
>          logger.debug("User Event triggered {}", evt);
>          if (evt instanceof ConnectEvent) {
> -            this.protocolBase.onConnect(new
> DefaultConversationContext<>(ctx, authentication, passive));
> +            this.protocolBase.onConnect(new
> DefaultConversationContext<>(this::registerHandler, ctx, authentication,
> passive));
>          } else if (evt instanceof DisconnectEvent) {
> -            this.protocolBase.onDisconnect(new
> DefaultConversationContext<>(ctx, authentication, passive));
> +            this.protocolBase.onDisconnect(new
> DefaultConversationContext<>(this::registerHandler, ctx, authentication,
> passive));
>          } else if (evt instanceof DiscoverEvent) {
> -            this.protocolBase.onDiscover(new
> DefaultConversationContext<>(ctx, authentication, passive));
> +            this.protocolBase.onDiscover(new
> DefaultConversationContext<>(this::registerHandler, ctx, authentication,
> passive));
>          } else if (evt instanceof CloseConnectionEvent) {
> -            this.protocolBase.close(new DefaultConversationContext<>(ctx,
> authentication, passive));
> +            this.protocolBase.close(new
> DefaultConversationContext<>(this::registerHandler, ctx, authentication,
> passive));
>
> Review Comment:
>    You're right, however I am not entirely sure of netty vs plc4x
> lifecycle. Namely can we reestablish connection  once we reached that
> point? At high level plc4x drivers support `connect` call, we would need to
> assure that it  always configure fresh pipeline and uses new timeout
> manager forcing netty to fire bootstrap procedure again.
>
>
>
> --
> This is an automated message from the Apache Git Service.
> To respond to the message, please log on to GitHub and use the
> URL above to go to the specific comment.
>
> To unsubscribe, e-mail: dev-unsubscr...@plc4x.apache.org
>
> For queries about this service, please contact Infrastructure at:
> us...@infra.apache.org
>
>

-- 
*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: support.aan.automat...@siemens.com
<support.aan.automat...@siemens.com>*

Reply via email to