2
2
3
3
import com .digitalpetri .modbus .Modbus ;
4
4
import com .digitalpetri .modbus .tcp .Netty ;
5
+ import com .digitalpetri .netty .fsm .ChannelFsmConfigBuilder ;
5
6
import io .netty .bootstrap .Bootstrap ;
6
7
import io .netty .channel .ChannelPipeline ;
7
8
import io .netty .channel .EventLoopGroup ;
26
27
* Bootstrap}.
27
28
* @param pipelineCustomizer a {@link Consumer} that can be used to customize the Netty {@link
28
29
* ChannelPipeline}.
30
+ * @param channelFsmCustomizer a {@link Consumer} that can be used to customize the {@link
31
+ * ChannelFsmConfigBuilder}.
29
32
* @param tlsEnabled whether to enable TLS (Modbus/TCP Security).
30
33
* @param keyManagerFactory the {@link KeyManagerFactory} to use if TLS is enabled.
31
34
* @param trustManagerFactory the {@link TrustManagerFactory} to use if TLS is enabled.
@@ -40,6 +43,7 @@ public record NettyClientTransportConfig(
40
43
ExecutorService executor ,
41
44
Consumer <Bootstrap > bootstrapCustomizer ,
42
45
Consumer <ChannelPipeline > pipelineCustomizer ,
46
+ Consumer <ChannelFsmConfigBuilder > channelFsmCustomizer ,
43
47
boolean tlsEnabled ,
44
48
Optional <KeyManagerFactory > keyManagerFactory ,
45
49
Optional <TrustManagerFactory > trustManagerFactory ) {
@@ -94,6 +98,9 @@ public static class Builder {
94
98
/** A {@link Consumer} that can be used to customize the Netty {@link ChannelPipeline}. */
95
99
public Consumer <ChannelPipeline > pipelineCustomizer = p -> {};
96
100
101
+ /** A {@link Consumer} that can be used to customize the {@link ChannelFsmConfigBuilder}. */
102
+ public Consumer <ChannelFsmConfigBuilder > channelFsmCustomizer = c -> {};
103
+
97
104
/** Whether to enable TLS (Modbus/TCP Security). */
98
105
public boolean tlsEnabled = false ;
99
106
@@ -206,6 +213,18 @@ public Builder setPipelineCustomizer(Consumer<ChannelPipeline> pipelineCustomize
206
213
return this ;
207
214
}
208
215
216
+ /**
217
+ * Set the {@link Consumer} that can be used to customize the {@link ChannelFsmConfigBuilder}.
218
+ *
219
+ * @param channelFsmCustomizer the {@link Consumer} that can be used to customize the {@link
220
+ * ChannelFsmConfigBuilder}.
221
+ * @return this Builder.
222
+ */
223
+ public Builder setChannelFsmCustomizer (Consumer <ChannelFsmConfigBuilder > channelFsmCustomizer ) {
224
+ this .channelFsmCustomizer = channelFsmCustomizer ;
225
+ return this ;
226
+ }
227
+
209
228
/**
210
229
* Set whether to enable TLS (Modbus/TCP Security).
211
230
*
@@ -271,6 +290,7 @@ public NettyClientTransportConfig build() {
271
290
executor ,
272
291
bootstrapCustomizer ,
273
292
pipelineCustomizer ,
293
+ channelFsmCustomizer ,
274
294
tlsEnabled ,
275
295
Optional .ofNullable (keyManagerFactory ),
276
296
Optional .ofNullable (trustManagerFactory ));
0 commit comments