public class WebSocketSolonAcpAgentTransport extends java.lang.Object implements AcpAgentTransport
| 限定符和类型 | 类和说明 |
|---|---|
class |
WebSocketSolonAcpAgentTransport.AcpWebSocketEndpoint
WebSocket 事件监听器实现
|
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
DEFAULT_ACP_PATH |
| 构造器和说明 |
|---|
WebSocketSolonAcpAgentTransport(McpJsonMapper jsonMapper) |
WebSocketSolonAcpAgentTransport(java.lang.String path,
McpJsonMapper jsonMapper) |
| 限定符和类型 | 方法和说明 |
|---|---|
reactor.core.publisher.Mono<java.lang.Void> |
awaitTermination()
Returns a Mono that completes when the transport terminates.
|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Closes the transport connection and releases any associated resources
asynchronously.
|
WebSocketSolonAcpAgentTransport |
idleTimeout(java.time.Duration timeout) |
reactor.core.publisher.Mono<java.lang.Void> |
sendMessage(AcpSchema.JSONRPCMessage message)
Sends a message to the peer asynchronously.
|
void |
setExceptionHandler(java.util.function.Consumer<java.lang.Throwable> handler)
Sets the exception handler for exceptions raised on the transport layer.
|
reactor.core.publisher.Mono<java.lang.Void> |
start(java.util.function.Function<reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>,reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>> handler)
Used to register the incoming messages' handler and start listening for client
connections.
|
<T> T |
unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
Unmarshals the given data into an object of the specified type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, protocolVersionspublic static final java.lang.String DEFAULT_ACP_PATH
public WebSocketSolonAcpAgentTransport(McpJsonMapper jsonMapper)
public WebSocketSolonAcpAgentTransport(java.lang.String path,
McpJsonMapper jsonMapper)
public WebSocketSolonAcpAgentTransport idleTimeout(java.time.Duration timeout)
public reactor.core.publisher.Mono<java.lang.Void> start(java.util.function.Function<reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>,reactor.core.publisher.Mono<AcpSchema.JSONRPCMessage>> handler)
AcpAgentTransportstart 在接口中 AcpAgentTransporthandler - a transformer for incoming messagesMono that terminates upon successful agent setup. The successful
termination of the returned Mono simply means the agent can now receive
requests. An error can be retried according to the application requirements.public reactor.core.publisher.Mono<java.lang.Void> sendMessage(AcpSchema.JSONRPCMessage message)
AcpTransportThis method handles the transmission of messages to the peer in an asynchronous manner. Messages are sent in JSON-RPC format as specified by the ACP protocol.
sendMessage 在接口中 AcpTransportmessage - the AcpSchema.JSONRPCMessage to be sent to the peerMono that completes when the message has been sentpublic reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
AcpTransportcloseGracefully 在接口中 AcpTransportMono that completes when the connection has been closed.public void setExceptionHandler(java.util.function.Consumer<java.lang.Throwable> handler)
AcpAgentTransportsetExceptionHandler 在接口中 AcpAgentTransporthandler - Allows reacting to transport level exceptions by the higher layerspublic reactor.core.publisher.Mono<java.lang.Void> awaitTermination()
AcpAgentTransportExample usage:
transport.start(handler).block();
transport.awaitTermination().block(); // Block until stdin closes
awaitTermination 在接口中 AcpAgentTransportMono that completes when the transport terminatespublic <T> T unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
AcpTransportunmarshalFrom 在接口中 AcpTransportT - the type of the object to unmarshaldata - the data to unmarshaltypeRef - the type reference for the object to unmarshal