Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,18 @@ Changes log
leaves the borrowed listener and supplied callback executor running and reports timeout
explicitly. TLS configuration and physical gRPC connection controls are not supported
by the server adapter.
- Added an experimental SDK-native gRPC unary client on a borrowed Restlet HTTP/2
connector, with explicit plaintext opt-in, bounded messages and call admission.
- Added an experimental SDK-native gRPC client on a borrowed Restlet HTTP/2 connector,
for unary, server-streaming, client-streaming and bidirectional calls, with explicit
plaintext opt-in, bounded messages and call admission. Each call is one HTTP/2 exchange
whose request body is written while its response is read; request messages are queued
within a per-call budget that the SDK's readiness follows, and response messages are read
as the application requests them, within the same budget.
Regression tests cover authority mapping, cancellation before and after headers,
disconnect recovery, malformed responses and shared connector ownership. Empty
responses retain SDK missing-status diagnostics instead of failing on a null stream.
Shutdown arriving before SDK listener installation is replayed once; interrupted
shutdown still closes owned transport resources and preserves the interrupt.
TLS, streaming methods and physical gRPC connection controls remain unsupported.
TLS and physical gRPC connection controls remain unsupported.
- Added the Smithy extension, with a smithy-java 1.8.0 client transport on Restlet HTTP
client connectors. Generated and dynamic SDK clients find it through service loading,
before the JDK transport, or are given one borrowing an existing client. Requests are
Expand Down
6 changes: 6 additions & 0 deletions org.restlet.ext.grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,11 @@
<version>${lib-junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${lib-junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
/**
* Single-use native gRPC channel on a borrowed Restlet HTTP/2 client.
*
* <p>This initial profile is unary and plaintext only; applications must explicitly opt in with
* {@link #setPlaintext(boolean)}. TLS/address separation, proxy CONNECT, streaming, retry,
* keepalive and physical-connection controls are not implemented. No SDK network transport is
* selected. The host starts and stops the borrowed connector.
* <p>Supports unary, server-streaming, client-streaming and bidirectional calls: each call is one
* HTTP/2 exchange whose request body is written while its response is read, so messages flow both
* ways at once. Request messages are queued within {@link #setMaxQueuedBytes}, and the SDK's
* readiness follows their writing; response messages are read as the application requests them,
* within the same budget. This profile is plaintext only; applications must explicitly opt in with
* {@link #setPlaintext(boolean)}. TLS/address separation, proxy CONNECT, retry, keepalive and
* physical-connection controls are not implemented. No SDK network transport is selected. The host
* starts and stops the borrowed connector.
*/
public final class GrpcClientAdapter implements AutoCloseable {
private final Context context;
Expand All @@ -40,6 +44,7 @@ public final class GrpcClientAdapter implements AutoCloseable {
private String target;
private boolean plaintext;
private int maxMessageBytes = 1024 * 1024;
private int maxQueuedBytes = 256 * 1024;
private int maxConcurrentCalls = 128;
private Duration maxCallDuration = Duration.ofSeconds(30);
private Duration shutdownTimeout = Duration.ofSeconds(5);
Expand Down Expand Up @@ -100,6 +105,25 @@ public synchronized int getMaxMessageBytes() {
return maxMessageBytes;
}

/**
* Sets the per-call queue budget, for each direction: request bytes waiting for the network,
* and response bytes read but not yet consumed by the messages the application requested. A
* single message may exceed it.
*
* @param value At least 16384 bytes.
*/
public synchronized void setMaxQueuedBytes(int value) {
requireConfigurable();
if (value < 16384) {
throw new IllegalArgumentException("Queue budget must be at least 16384 bytes");
}
maxQueuedBytes = value;
}

public synchronized int getMaxQueuedBytes() {
return maxQueuedBytes;
}

public synchronized void setMaxConcurrentCalls(int value) {
requireConfigurable();
if (value <= 0) {
Expand Down Expand Up @@ -191,7 +215,11 @@ public synchronized void start() {
configured = true;
var factory =
new RestletTransportFactory(
client, maxMessageBytes, maxConcurrentCalls, shutdownTimeout);
client,
maxMessageBytes,
maxQueuedBytes,
maxConcurrentCalls,
shutdownTimeout);
try {
var builder =
new ManagedChannelImplBuilder(target, () -> factory, () -> 80)
Expand Down
Loading
Loading