Good point Lukasz,

Might be a viable option … you do need to program against the SPI in that case 
however.
I just noticed that I tried to reuse the readRequest inside a 
try-with-connection block and noticed that was BS and as soon as the connection 
dies, the pre-built request is no longer usable.

Not 100% happy with the fact, that it’s not an API feature. We could possibly 
move the PlcReader interface and its fellows into the API.

Chris

Von: Łukasz Dywicki <[email protected]>
Datum: Samstag, 8. November 2025 um 14:08
An: [email protected] <[email protected]>
Betreff: Re: [DISCUSS] Re-Using PlcRequests with multiple connections?

Our API is constructed in such a way that end user does not need to pass
connection to read/write calls. All our interactions start from connection.
However we have high level interfaces such as PlcReader/PlcWriter which
accept read/write requests.
So to me it looks like its possible to pass request from one connection
to other. You just can't use request.execute() but use reader.read(request).

Best,
Łukasz

On 11/7/25 21:31, Christofer Dutz wrote:
> Hi all,
>
> Today I stumbled over something when I was testing re-connect behavior when 
> re-using PlcReadRequests over a connection (Like using the connection-cache). 
> This seems to work fine as long as the initial connection is still available. 
> I think I wouldn’t even need to get the connection to execute the repeated 
> read operation. This also could result in concurrent execution of requests.
>
> I think possibly passing in the connection to the execute method and using 
> that to execute the operation would be an option. We would need to save the 
> connection string for which a request was built and then check this on every 
> execution.
>
> The more I think of it the more problematic do I think this issue is.
>
> However it would be quite a big breaking change :-(
>
> Chris
>
>

Reply via email to