Package com.zb.mom.ww.mxgateway.client
Class MxGatewayClientOptions.Builder
java.lang.Object
com.zb.mom.ww.mxgateway.client.MxGatewayClientOptions.Builder
- Enclosing class:
MxGatewayClientOptions
Mutable builder for
MxGatewayClientOptions.-
Method Summary
Modifier and TypeMethodDescriptionSets the API key sent in theauthorizationheader.build()Builds an immutableMxGatewayClientOptionsfrom the current state.caCertificatePath(Path value) Sets the CA certificate used to verify the gateway server.callTimeout(Duration value) Sets the per-call deadline applied to unary RPCs.connectTimeout(Duration value) Sets the channel connect timeout.Sets the gRPC target endpoint.maxGrpcMessageBytes(int value) plaintext(boolean value) Selects plaintext transport instead of TLS.requireCertificateValidation(boolean value) Whentrue, TLS connections without a pinned CA use the OS trust store and will reject the gateway's self-signed certificate.serverNameOverride(String value) Overrides the TLS server name used during the handshake.streamTimeout(Duration value) Sets the deadline applied to server-streaming RPCs.
-
Method Details
-
endpoint
Sets the gRPC target endpoint.- Parameters:
value- endpoint inhost:portor DNS-target form; required- Returns:
- this builder
-
apiKey
Sets the API key sent in theauthorizationheader.- Parameters:
value- the API key, ornull/blank to disable authentication- Returns:
- this builder
-
plaintext
Selects plaintext transport instead of TLS.- Parameters:
value-truefor plaintext,falsefor TLS- Returns:
- this builder
-
caCertificatePath
Sets the CA certificate used to verify the gateway server.- Parameters:
value- path to a PEM-encoded CA certificate, ornullto use the platform trust store- Returns:
- this builder
-
requireCertificateValidation
Whentrue, TLS connections without a pinned CA use the OS trust store and will reject the gateway's self-signed certificate. Whenfalse(default), the gateway certificate is accepted without verification — appropriate for this internal tool's auto-generated self-signed certificate. Pinning a CA viacaCertificatePath(Path)always verifies.- Parameters:
value-trueto require certificate validation,falseto accept any cert- Returns:
- this builder
-
serverNameOverride
Overrides the TLS server name used during the handshake.- Parameters:
value- the override host name, or empty/nullfor none- Returns:
- this builder
-
connectTimeout
Sets the channel connect timeout.- Parameters:
value- the connect timeout, must be non-null- Returns:
- this builder
- Throws:
NullPointerException- ifvalueisnull
-
callTimeout
Sets the per-call deadline applied to unary RPCs.- Parameters:
value- the call timeout, must be non-null- Returns:
- this builder
- Throws:
NullPointerException- ifvalueisnull
-
streamTimeout
Sets the deadline applied to server-streaming RPCs.- Parameters:
value- the stream timeout, must be non-null- Returns:
- this builder
- Throws:
NullPointerException- ifvalueisnull
-
maxGrpcMessageBytes
-
build
Builds an immutableMxGatewayClientOptionsfrom the current state.- Returns:
- a new options instance
- Throws:
IllegalArgumentException- ifendpointwas not set or is blank
-