This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/rocketmq-a2a.git
The following commit(s) were added to refs/heads/main by this push:
new d8111fd Optimize the code (#16)
d8111fd is described below
commit d8111fd8c58e014a2f7ed8b00fbb03c55177304f
Author: Drizzle <[email protected]>
AuthorDate: Tue Feb 3 22:37:48 2026 +0800
Optimize the code (#16)
* update
Change-Id: Icb48afcf44893ad3c07fc0e243e333096d8e3ec0
* optimize the code
Change-Id: Iaa158a2bd2bc55475e7c55e7ae3392b4e2f28fa0
* optimize the code
Change-Id: I9fba77a503e387b5d9feab13cd144021b938ec1f
* update
Change-Id: Ia842ff8df57e018a36c672c9ddc7d1c7f42240f3
* update
Change-Id: Ibfe44c7be6f7a25be6ba74644ac0e9bee9a8ce43
* update
Change-Id: I6ba98dca2dc8001494aec4ddbe4e8bea38f8250a
* update
Change-Id: Ib0f380ba1f073608842c4ad467757368e331bdeb
* update
Change-Id: I3034540314cc832d68a1095fdb5a1366f2b26864
* update
Change-Id: Ie22cf3da240e10ae70800f8c1443134c70c9215f
* optimize the code
Change-Id: I0bc42ef1f8813d4ed538810c27c8e468cda90309
* update
Change-Id: I31f0bfda2a217979be592c533065268f03418951
* update
Change-Id: If3147fde462620d5fa71a71c86a574babcc23589
* update
Change-Id: I5b711a35249a0525a749af7e92bbe4547f9eb910
* update
Change-Id: I6cd9b87e7aeeb85137ba324f79f17b386cf2bef8
* update
Change-Id: I5134715702d491ce02a900e9ca36bc214c20141e
* update
Change-Id: I8031f2fbe0dbd69ec40f23b7a7d6dab3ef53e047
* update
Change-Id: Ic418be82f1e52191d5c2afd7307c64f9962fe943
* update
Change-Id: Ibe5bbedcd98166602dcc760636d4433c33e80556
* add remote lite consumer
Change-Id: I9e547f667fa0f415d58f93ceeb9db4677c19c497
* add non stream
Change-Id: I942060900dee38be155e22500cd7fec86603de4c
* add server lite consumer
Change-Id: I08810df630ecae17601c31406b5920552a846b2d
* update
Change-Id: Iaae4766dfffbe6551e2309be98424cab137bdfc6
* add annoation
Change-Id: Ic38151d973adecc5fc9c6a73f1947ae2eca3aea0
* add annotation
Change-Id: I82d13fc5472e41c23de977027e9ff84a96e3db81
* add annotation
Change-Id: I63dfd7d6920f95deaa4a1b47528f4198734d9b9f
* update
Change-Id: Ib8ca53fd6dd3c711432c1ced007a8b5504e5d7df
* update
Change-Id: Ia4e08f2eb9519d1fd61a8a4711bd8ee65ada9829
* update
Change-Id: If58a01cb5e40cc3483b64883ccbb5d771a2cd87f
* update
Change-Id: I38151434b2c22f1f3525c4f98fd6ff0203bc5bc8
* update the code
Change-Id: Idf304840cd935e2ba63aad78bdf1551394ffa9f0
* update
Change-Id: I884db3542e08d2929ec01c35fa98eda4feff95cb
* update
Change-Id: I69e9aa12b18099539696a057cd6554bd9c5644b3
* update
Change-Id: Ibf2978963f707105d1626911cfef6ea0e97299d9
* update
Change-Id: Ib82f9e37fca0ecd453aa80ee018992d8bb236106
* update
Change-Id: If5f1ab5ca25e10ef85f0f214b45ceaf01ed64cb3
* update
Change-Id: I31f6c0131f88cafa012fb398b8a9e3cc29f99eab
* update
Change-Id: I3049808264927415ba969c4f4f3bf9d0c0d43576
* update
Change-Id: I4d6949bf6752a072ff1baf6c0cc5836482bb7400
* update
Change-Id: I8b945937f5b0f8079f5c4eec4bddd0cf34301c75
* optimize the code
Change-Id: If4b03bed77292ad62fb0954f00566b1a24975f28
* update
Change-Id: I56576f9077e78e93c307e0e16bb519a6be573202
* update
Change-Id: Ib870349c05faa007055e7cfa1ba3775a48901147
* optimize the code
Change-Id: Idda0aa62ab32f808b33d0e3c821e06e040289055
* update
Change-Id: I8f60af1e48d9d8149a8988ffcbe16f75ca28cc6c
* update
Change-Id: If0265c2e6ddb8ad7ab4c8f1d7b1f73886cd97f74
* update
Change-Id: I9e95f7be172c138706681ce92020477410d94ab9
* update annotation
Change-Id: Id60334389c848aa0e839fb8e4fabd5fd3fc7a69c
* optimize the code
Change-Id: I5112d95e4d8b76b379d6c1882b2bc4a9a515105f
* update code
Change-Id: Id08764e213773787c5a4fec8333f70f6733fbc36
* update
Change-Id: Ifd738bb7df10d6e669672f482da61412d95e2cac
* update the code
Change-Id: Ic03c1e0ef5310bc2aaad37e93dd110381cf137ab
* update
Change-Id: Iaa534ab0d0281395e786a162aabefb885d296b33
* update code
Change-Id: I35802501ccbdadd859c3e394dc74085d6bf2dfa0
* update
Change-Id: I1dcb46a59aa86d68734f2f0b3a9ba2074e90f9a2
* update code
Change-Id: I9f6d925422314eb5edb0b2925ed86570419352c4
* update code
Change-Id: I73511c908a187343ac826cc931636a8bfec6c1fc
* update the code
Change-Id: I75accb0ce6c1fd09419f75200f455ded91deccce
* update
Change-Id: Ie2ec0e960b4ed88e3bcf3957c59a5a80962ce06e
* update code
Change-Id: Ie542dacb9f1f434be167c558ae13ba379784561d
* update code
Change-Id: I80bb9c2d5fbcb65561f079103447e9873d4188fe
* update code
Change-Id: I90f9ec7d204df8f852db50fd8e8f9f4dc5d9768d
* optimize the code
Change-Id: I0f4eb90a41e3ce076858a8d8afc5a554ecab80ed
* update code
Change-Id: I5b25a9a5c7b5e3b1834e63d424757ef1dd00c4e1
* optimize the common
Change-Id: I8dc1b8adc87590a7c9d209fbc20b06ab2452d892
* update the code
Change-Id: I3fa211cbbf395ea00a992a22f2e0091681b99a88
* update code
Change-Id: I54378a6d2def8906a9ced7dda96c2f1386a84200
* update code
Change-Id: I525ff312a3aadc4449ad9d3f529790032c2ec365
* update the code
Change-Id: I392edcccbe0cfc4d22451e1b6d5d576fbfb8ffd9
* optimize the code
Change-Id: I9ed139c311cc7db391abd6643879f35f5f074c3b
* update code
Change-Id: I2d6d870e58258fa705180eb565c88a3b374e1742
* update
Change-Id: I6c7ef992aa148d72393fa593ec0537333e19f6a1
* update
Change-Id: I2ab836bc51e232a9123e70769a97439dcc6f51e8
* update
Change-Id: I3c7893d1dbe145c728ce56609773d832b745b93f
* update
Change-Id: I4fabf470c9b74edf40962f81ad2eae80f9259bc0
* optimize the code
Change-Id: Id30bab119956c66c7f3be8d8f536ed30bd1c52f8
* update code
Change-Id: Ic51400ec73246e12b084113e9dbe5b52c2238edc
* update
Change-Id: Ib3ea899a15099e5cbc3a9b2d17c05e3c19722bee
* update
Change-Id: Ib79793828b6e237e2d73d46f8b6a5c284f62f585
* update code
Change-Id: I6feaf18e83ed4da665d584c86bb51d9b17d3bd34
* update code
Change-Id: I7a57527d269dd1d8a9b96e203d4755939cea6919
* update
Change-Id: Ice76ac6620423e1581b013508c4da4b1066ba347
* update
Change-Id: I543dc8596fd284207cc55a84f355871453e8fb1d
* update
Change-Id: I9168035b9a34b74cf436c6498270aed91431666a
* add example about agent-scope
Change-Id: I3e4f2938914a173068f066378963d2c1356d041d
* update
Change-Id: I11415c17954459bd8bf82e19d9187cf72aac5b0e
* update
Change-Id: I2c236f30848df9493066f911834e5735e344fa44
* update
Change-Id: I16228f8e017657905df8caf6cb94ac0da07a0dde
* update version
Change-Id: I66d99c0bb738dcb5e4d0c212d2a896024176094d
* update
Change-Id: I4605bdec1b502d84b55f96f3bf4a50f9a99eca80
* update
Change-Id: Idbb88b4a753fbeea362876e680a26787d5e01a0c
* update
Change-Id: I95c32a5f977ab4bb5fec4a4b34c5a0da538e3bb1
* update
Change-Id: I2d3a6e70ad95e517dde85da27bb0b3317191ef5d
* update
Change-Id: I7d9048597ce4244a59a5a23d2567657c1d5a2bd9
* update
Change-Id: I548a68af3d41507ba368113ea2c5746afa7a29c0
* update
Change-Id: I7e377d8ac1442aa9c0433d5d66465db7efe3c43f
* update code
Change-Id: Iaeb21e9e1bdd477ff293008549d17ae97c367130
* update code
Change-Id: I37aaeafae4ca9550633e6ae60f59067e91710df7
* update code
Change-Id: I2b68ef9c325d145b06ec8e3211450751b0f2dbe2
* update the code
Change-Id: I474b20ea81e821094343482db66dc1ab34a164bb
* update code
Change-Id: I9437a267c4d0bc3f0c672e3d2654e0cda0cb7e09
* update code
Change-Id: I5c009d956b96b5033d1496fb06bb6a546c1ed394
* update the code
Change-Id: Ie734572b07f0025fa0ed79461e6d68ff61357362
---------
Co-authored-by: drizzle.zk <[email protected]>
---
pom.xml | 2 +-
.../a2a/common/future/A2AResponseFuture.java | 38 ++++
.../rocketmq/a2a/common/model/RocketMQRequest.java | 110 ++++++++++++
.../a2a/common/model/RocketMQResource.java | 61 +++++++
.../a2a/common/model/RocketMQResponse.java | 144 +++++++++++++++
.../rocketmq/a2a/common/model/ServerReceipt.java | 44 ++++-
.../transport/config/RocketMQTransportConfig.java | 198 ++++++++++++++++++++-
.../provider/RocketMQTransportProvider.java | 2 +-
8 files changed, 595 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index ca5f728..5bdde1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-a2a</artifactId>
- <version>1.0.9-SNAPSHOT</version>
+ <version>1.0.9</version>
<name>Apache RocketMQ A2A ${project.version}</name>
<description>Integrate Apache RocketMQ with A2A</description>
diff --git
a/src/main/java/org/apache/rocketmq/a2a/common/future/A2AResponseFuture.java
b/src/main/java/org/apache/rocketmq/a2a/common/future/A2AResponseFuture.java
index 7bd1461..a705fed 100644
--- a/src/main/java/org/apache/rocketmq/a2a/common/future/A2AResponseFuture.java
+++ b/src/main/java/org/apache/rocketmq/a2a/common/future/A2AResponseFuture.java
@@ -51,32 +51,70 @@ public class A2AResponseFuture {
this.typeReference = typeReference;
}
+ /**
+ * Returns the {@link CompletableFuture} that holds the raw JSON response
string.
+ *
+ * @return the {@link CompletableFuture} containing the raw JSON response.
+ */
public CompletableFuture<String> getCompletableFuture() {
return completableFuture;
}
+ /**
+ * Returns the {@link TypeReference} used for deserializing the JSON
response.
+ *
+ * @return the {@link TypeReference} specifying the target type for
deserialization.
+ */
public TypeReference getTypeReference() {
return typeReference;
}
+ /**
+ * Creates and returns a new {@link Builder} instance for constructing
{@code A2AResponseFuture} objects.
+ *
+ * @return a new {@link Builder} instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * A builder class for constructing {@code A2AResponseFuture} instances.
+ * Provides a fluent API for setting the required components.
+ */
public static class Builder {
private CompletableFuture<String> completableFuture;
private TypeReference<?> typeReference;
+ /**
+ * Sets the {@link CompletableFuture} that will hold the raw JSON
response.
+ *
+ * @param completableFuture the {@link CompletableFuture} to set.
+ * @return this builder instance for method chaining.
+ */
public Builder completableFuture(CompletableFuture<String>
completableFuture) {
this.completableFuture = completableFuture;
return this;
}
+ /**
+ * Sets the {@link TypeReference} that specifies the target type for
deserializing the JSON response.
+ *
+ * @param typeReference the {@link TypeReference} to set.
+ * @return this builder instance for method chaining.
+ */
public Builder typeReference(TypeReference<?> typeReference) {
this.typeReference = typeReference;
return this;
}
+ /**
+ * Builds and returns a new {@code A2AResponseFuture} instance.
+ * Validates that both {@code completableFuture} and {@code
typeReference} are not null.
+ *
+ * @return a new {@code A2AResponseFuture} instance.
+ * @throws IllegalArgumentException if either {@code
completableFuture} or {@code typeReference} is null.
+ */
public A2AResponseFuture build() {
if (completableFuture == null) {
throw new IllegalArgumentException("completableFuture must not
be null");
diff --git
a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQRequest.java
b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQRequest.java
index eb5c7de..6c13bc5 100644
--- a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQRequest.java
+++ b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQRequest.java
@@ -64,40 +64,90 @@ public class RocketMQRequest {
*/
private String liteTopic;
+ /**
+ * Default constructor for creating an instance of RocketMQRequest.
+ */
public RocketMQRequest() {}
+ /**
+ * Gets the serialized request body.
+ *
+ * @return the request body as a string.
+ */
public String getRequestBody() {
return requestBody;
}
+ /**
+ * Sets the serialized request body.
+ *
+ * @param requestBody the request body to set.
+ */
public void setRequestBody(String requestBody) {
this.requestBody = requestBody;
}
+ /**
+ * Gets the protocol headers.
+ *
+ * @return the map of request headers.
+ */
public Map<String, String> getRequestHeader() {
return requestHeader;
}
+ /**
+ * Sets the protocol headers.
+ *
+ * @param requestHeader the map of request headers to set.
+ */
public void setRequestHeader(Map<String, String> requestHeader) {
this.requestHeader = requestHeader;
}
+ /**
+ * Gets the destination agent topic.
+ *
+ * @return the destination agent topic.
+ */
public String getDestAgentTopic() {
return destAgentTopic;
}
+ /**
+ * Sets the destination agent topic.
+ *
+ * @param destAgentTopic the destination agent topic to set.
+ */
public void setDestAgentTopic(String destAgentTopic) {
this.destAgentTopic = destAgentTopic;
}
+ /**
+ * Gets the LiteTopic used for session identification.
+ *
+ * @return the LiteTopic.
+ */
public String getLiteTopic() {
return liteTopic;
}
+ /**
+ * Sets the LiteTopic used for session identification.
+ *
+ * @param liteTopic the LiteTopic to set.
+ */
public void setLiteTopic(String liteTopic) {
this.liteTopic = liteTopic;
}
+ /**
+ * Adds a header to the request headers map.
+ * Initializes the map if it is null.
+ *
+ * @param key the header key.
+ * @param value the header value.
+ */
public void addHeader(String key, String value) {
if (null == requestHeader) {
requestHeader = new HashMap<>();
@@ -105,51 +155,111 @@ public class RocketMQRequest {
requestHeader.put(key, value);
}
+ /**
+ * Gets the dedicated topic for receiving reply messages.
+ *
+ * @return the work agent response topic.
+ */
public String getWorkAgentResponseTopic() {
return workAgentResponseTopic;
}
+ /**
+ * Sets the dedicated topic for receiving reply messages.
+ *
+ * @param workAgentResponseTopic the work agent response topic to set.
+ */
public void setWorkAgentResponseTopic(String workAgentResponseTopic) {
this.workAgentResponseTopic = workAgentResponseTopic;
}
+ /**
+ * Creates a new builder instance for constructing RocketMQRequest objects.
+ *
+ * @return a new Builder instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Builder class for constructing RocketMQRequest instances.
+ */
public static class Builder {
private final RocketMQRequest request = new RocketMQRequest();
+ /**
+ * Sets the request body.
+ *
+ * @param requestBody the request body to set.
+ * @return the current Builder instance.
+ */
public Builder requestBody(String requestBody) {
request.setRequestBody(requestBody);
return this;
}
+ /**
+ * Sets the destination agent topic.
+ *
+ * @param destAgentTopic the destination agent topic to set.
+ * @return the current Builder instance.
+ */
public Builder destAgentTopic(String destAgentTopic) {
request.setDestAgentTopic(destAgentTopic);
return this;
}
+ /**
+ * Sets the work agent response topic.
+ *
+ * @param workAgentResponseTopic the work agent response topic to set.
+ * @return the current Builder instance.
+ */
public Builder workAgentResponseTopic(String workAgentResponseTopic) {
request.setWorkAgentResponseTopic(workAgentResponseTopic);
return this;
}
+ /**
+ * Sets the LiteTopic.
+ *
+ * @param liteTopic the LiteTopic to set.
+ * @return the current Builder instance.
+ */
public Builder liteTopic(String liteTopic) {
request.setLiteTopic(liteTopic);
return this;
}
+ /**
+ * Sets the request headers.
+ *
+ * @param requestHeader the map of request headers to set.
+ * @return the current Builder instance.
+ */
public Builder requestHeader(Map<String, String> requestHeader) {
request.setRequestHeader(requestHeader);
return this;
}
+ /**
+ * Adds a single header to the request headers.
+ *
+ * @param key the header key.
+ * @param value the header value.
+ * @return the current Builder instance.
+ */
public Builder addHeader(String key, String value) {
request.addHeader(key, value);
return this;
}
+ /**
+ * Builds and returns the constructed RocketMQRequest instance.
+ *
+ * @return the constructed RocketMQRequest.
+ */
public RocketMQRequest build() {
return request;
}
diff --git
a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResource.java
b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResource.java
index 38df62b..24360fe 100644
--- a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResource.java
+++ b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResource.java
@@ -41,52 +41,113 @@ public class RocketMQResource {
*/
public RocketMQResource() {}
+ /**
+ * Gets the endpoint of the RocketMQ service.
+ *
+ * @return the endpoint as a String.
+ */
public String getEndpoint() {
return endpoint;
}
+ /**
+ * Sets the endpoint of the RocketMQ service.
+ *
+ * @param endpoint the endpoint to set.
+ */
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
+ /**
+ * Gets the topic of the RocketMQ service.
+ *
+ * @return the topic as a String.
+ */
public String getTopic() {
return topic;
}
+ /**
+ * Sets the topic of the RocketMQ service.
+ *
+ * @param topic the topic to set.
+ */
public void setTopic(String topic) {
this.topic = topic;
}
+ /**
+ * Gets the namespace of the RocketMQ service.
+ *
+ * @return the namespace as a String.
+ */
public String getNamespace() {
return namespace;
}
+ /**
+ * Sets the namespace of the RocketMQ service.
+ *
+ * @param namespace the namespace to set.
+ */
public void setNamespace(String namespace) {
this.namespace = namespace;
}
+ /**
+ * Creates a new Builder instance for constructing RocketMQResource
objects.
+ *
+ * @return a new Builder instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Builder class for constructing RocketMQResource instances.
+ */
public static class Builder {
private final RocketMQResource info = new RocketMQResource();
+ /**
+ * Sets the namespace for the RocketMQResource being built.
+ *
+ * @param namespace the namespace to set.
+ * @return the current Builder instance.
+ */
public Builder namespace(String namespace) {
info.setNamespace(namespace);
return this;
}
+ /**
+ * Sets the endpoint for the RocketMQResource being built.
+ *
+ * @param endpoint the endpoint to set.
+ * @return the current Builder instance.
+ */
public Builder endpoint(String endpoint) {
info.setEndpoint(endpoint);
return this;
}
+ /**
+ * Sets the topic for the RocketMQResource being built.
+ *
+ * @param topic the topic to set.
+ * @return the current Builder instance.
+ */
public Builder topic(String topic) {
info.setTopic(topic);
return this;
}
+ /**
+ * Builds and returns the constructed RocketMQResource instance.
+ *
+ * @return the constructed RocketMQResource instance.
+ */
public RocketMQResource build() {
return info;
}
diff --git
a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResponse.java
b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResponse.java
index a07e2d0..7e1ef58 100644
--- a/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResponse.java
+++ b/src/main/java/org/apache/rocketmq/a2a/common/model/RocketMQResponse.java
@@ -80,119 +80,263 @@ public class RocketMQResponse {
*/
private String serverLiteTopic;
+ /**
+ * Default constructor for creating an instance of {@code
RocketMQResponse}.
+ */
public RocketMQResponse() {}
+ /**
+ * Gets the response body content.
+ *
+ * @return the response body as a string
+ */
public String getResponseBody() {
return responseBody;
}
+ /**
+ * Sets the response body content.
+ *
+ * @param responseBody the response body to set
+ */
public void setResponseBody(String responseBody) {
this.responseBody = responseBody;
}
+ /**
+ * Gets the message ID associated with this response.
+ *
+ * @return the message ID as a string.
+ */
public String getMessageId() {
return messageId;
}
+ /**
+ * Sets the message ID for this response.
+ *
+ * @param messageId the message ID to set
+ */
public void setMessageId(String messageId) {
this.messageId = messageId;
}
+ /**
+ * Checks if this response is part of a streaming sequence.
+ *
+ * @return {@code true} if it's a streaming response, {@code false}
otherwise
+ */
public boolean isStream() {
return isStream;
}
+ /**
+ * Sets whether this response is part of a streaming sequence.
+ *
+ * @param stream {@code true} to indicate streaming, {@code false}
otherwise
+ */
public void setStream(boolean stream) {
isStream = stream;
}
+ /**
+ * Checks if this is the final message in a streaming sequence.
+ *
+ * @return {@code true} if it's the final message, {@code false} otherwise
+ */
public boolean isEnd() {
return isEnd;
}
+ /**
+ * Sets whether this is the final message in a streaming sequence.
+ *
+ * @param end {@code true} to indicate the end of the stream, {@code
false} otherwise
+ */
public void setEnd(boolean end) {
isEnd = end;
}
+ /**
+ * Gets the context ID for this response.
+ *
+ * @return the context ID as a string.
+ */
public String getContextId() {
return contextId;
}
+ /**
+ * Sets the context ID for this response.
+ *
+ * @param contextId the context ID to set
+ */
public void setContextId(String contextId) {
this.contextId = contextId;
}
+ /**
+ * Gets the task ID associated with this response.
+ *
+ * @return the task ID as a string.
+ */
public String getTaskId() {
return taskId;
}
+ /**
+ * Sets the task ID for this response.
+ *
+ * @param taskId the task ID to set
+ */
public void setTaskId(String taskId) {
this.taskId = taskId;
}
+ /**
+ * Gets the server work agent response topic.
+ *
+ * @return the server work agent response topic as a string.
+ */
public String getServerWorkAgentResponseTopic() {
return serverWorkAgentResponseTopic;
}
+ /**
+ * Sets the server work agent response topic.
+ *
+ * @param serverWorkAgentResponseTopic the topic to set
+ */
public void setServerWorkAgentResponseTopic(String
serverWorkAgentResponseTopic) {
this.serverWorkAgentResponseTopic = serverWorkAgentResponseTopic;
}
+ /**
+ * Gets the server lite topic.
+ *
+ * @return the server lite topic as a string.
+ */
public String getServerLiteTopic() {
return serverLiteTopic;
}
+ /**
+ * Sets the server lite topic.
+ *
+ * @param serverLiteTopic the lite topic to set.
+ */
public void setServerLiteTopic(String serverLiteTopic) {
this.serverLiteTopic = serverLiteTopic;
}
+ /**
+ * Creates a new builder instance for constructing {@code
RocketMQResponse} objects.
+ *
+ * @return a new {@code Builder} instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Builder class for constructing {@code RocketMQResponse} instances.
+ */
public static class Builder {
private final RocketMQResponse response = new RocketMQResponse();
+ /**
+ * Sets the response body.
+ *
+ * @param responseBody the response body to set.
+ * @return the current builder instance.
+ */
public Builder responseBody(String responseBody) {
response.setResponseBody(responseBody);
return this;
}
+ /**
+ * Sets the message ID.
+ *
+ * @param messageId the message ID to set.
+ * @return the current builder instance.
+ */
public Builder messageId(String messageId) {
response.setMessageId(messageId);
return this;
}
+ /**
+ * Sets whether this is a streaming response.
+ *
+ * @param stream {@code true} for streaming, {@code false} otherwise.
+ * @return the current builder instance.
+ */
public Builder stream(boolean stream) {
response.setStream(stream);
return this;
}
+ /**
+ * Sets whether this is the final message in a stream.
+ *
+ * @param end {@code true} to mark the end of the stream, {@code
false} otherwise.
+ * @return the current builder instance.
+ */
public Builder end(boolean end) {
response.setEnd(end);
return this;
}
+ /**
+ * Sets the context ID.
+ *
+ * @param contextId the context ID to set.
+ * @return the current builder instance.
+ */
public Builder contextId(String contextId) {
response.setContextId(contextId);
return this;
}
+ /**
+ * Sets the task ID.
+ *
+ * @param taskId the task ID to set.
+ * @return the current builder instance.
+ */
public Builder taskId(String taskId) {
response.setTaskId(taskId);
return this;
}
+ /**
+ * Sets the server work agent response topic.
+ *
+ * @param serverWorkAgentResponseTopic the topic to set.
+ * @return the current builder instance.
+ */
public Builder serverWorkAgentResponseTopic(String
serverWorkAgentResponseTopic) {
response.setServerWorkAgentResponseTopic(serverWorkAgentResponseTopic);
return this;
}
+ /**
+ * Sets the server lite topic.
+ *
+ * @param serverLiteTopic the lite topic to set.
+ * @return the current builder instance.
+ */
public Builder serverLiteTopic(String serverLiteTopic) {
response.setServerLiteTopic(serverLiteTopic);
return this;
}
+ /**
+ * Builds and returns the constructed {@code RocketMQResponse} object.
+ *
+ * @return the built {@code RocketMQResponse} instance.
+ */
public RocketMQResponse build() {
return response;
}
diff --git
a/src/main/java/org/apache/rocketmq/a2a/common/model/ServerReceipt.java
b/src/main/java/org/apache/rocketmq/a2a/common/model/ServerReceipt.java
index 4ea2f3c..8f29f10 100644
--- a/src/main/java/org/apache/rocketmq/a2a/common/model/ServerReceipt.java
+++ b/src/main/java/org/apache/rocketmq/a2a/common/model/ServerReceipt.java
@@ -17,7 +17,8 @@
package org.apache.rocketmq.a2a.common.model;
/**
- * Server receipt information
+ * ServerReceipt represents the server's receipt information for client-server
interactions.
+ * It encapsulates details such as the response topic and lite topic used for
communication.
*/
public class ServerReceipt {
/**
@@ -33,37 +34,78 @@ public class ServerReceipt {
*/
private final String serverLiteTopic;
+ /**
+ * Constructs a ServerReceipt instance with the specified response topic
and lite topic.
+ *
+ * @param serverWorkAgentResponseTopic The response topic for server
communication.
+ * @param serverLiteTopic The lite topic associated with the
response topic.
+ */
public ServerReceipt(String serverWorkAgentResponseTopic, String
serverLiteTopic) {
this.serverWorkAgentResponseTopic = serverWorkAgentResponseTopic;
this.serverLiteTopic = serverLiteTopic;
}
+ /**
+ * Returns the server work agent response topic.
+ *
+ * @return The response topic used for server communication.
+ */
public String getServerWorkAgentResponseTopic() {
return serverWorkAgentResponseTopic;
}
+ /**
+ * Returns the server lite topic.
+ *
+ * @return The lite topic associated with the response topic.
+ */
public String getServerLiteTopic() {
return serverLiteTopic;
}
+ /**
+ * Creates a new Builder instance for constructing ServerReceipt objects.
+ *
+ * @return A new Builder instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Builder class for constructing ServerReceipt instances in a fluent
manner.
+ */
public static class Builder {
private String serverWorkAgentResponseTopic;
private String serverLiteTopic;
+ /**
+ * Sets the server work agent response topic for the ServerReceipt
being built.
+ *
+ * @param serverWorkAgentResponseTopic The response topic for server
communication.
+ * @return This Builder instance for method chaining.
+ */
public Builder serverWorkAgentResponseTopic(String
serverWorkAgentResponseTopic) {
this.serverWorkAgentResponseTopic = serverWorkAgentResponseTopic;
return this;
}
+ /**
+ * Sets the server lite topic for the ServerReceipt being built.
+ *
+ * @param serverLiteTopic The lite topic associated with the response
topic.
+ * @return This Builder instance for method chaining.
+ */
public Builder serverLiteTopic(String serverLiteTopic) {
this.serverLiteTopic = serverLiteTopic;
return this;
}
+ /**
+ * Builds and returns a new ServerReceipt instance with the configured
properties.
+ *
+ * @return A new ServerReceipt instance.
+ */
public ServerReceipt build() {
return new ServerReceipt(serverWorkAgentResponseTopic,
serverLiteTopic);
}
diff --git
a/src/main/java/org/apache/rocketmq/a2a/transport/config/RocketMQTransportConfig.java
b/src/main/java/org/apache/rocketmq/a2a/transport/config/RocketMQTransportConfig.java
index 3702432..711ed02 100644
---
a/src/main/java/org/apache/rocketmq/a2a/transport/config/RocketMQTransportConfig.java
+++
b/src/main/java/org/apache/rocketmq/a2a/transport/config/RocketMQTransportConfig.java
@@ -109,104 +109,230 @@ public class RocketMQTransportConfig extends
ClientTransportConfig<RocketMQTrans
this.useDefaultRecoverMode = useDefaultRecoverMode;
}
+ /**
+ * Default constructor.
+ */
public RocketMQTransportConfig() {}
+ /**
+ * Constructor with HttpClient parameter.
+ *
+ * @param httpClient the HTTP client to be used.
+ */
public RocketMQTransportConfig(A2AHttpClient httpClient) {
this.httpClient = httpClient;
}
+ /**
+ * Gets the HTTP client.
+ *
+ * @return the HTTP client.
+ */
public A2AHttpClient getHttpClient() {
return httpClient;
}
+ /**
+ * Gets the secret key.
+ *
+ * @return the secret key.
+ */
public String getSecretKey() {
return secretKey;
}
+ /**
+ * Sets the secret key.
+ *
+ * @param secretKey the secret key to set.
+ */
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
+ /**
+ * Gets the endpoint.
+ *
+ * @return the endpoint.
+ */
public String getEndpoint() {
return endpoint;
}
+ /**
+ * Sets the endpoint.
+ *
+ * @param endpoint the endpoint to set.
+ */
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
+ /**
+ * Gets the namespace.
+ *
+ * @return the namespace.
+ */
public String getNamespace() {
return namespace;
}
+ /**
+ * Sets the namespace.
+ *
+ * @param namespace the namespace to set.
+ */
public void setNamespace(String namespace) {
this.namespace = namespace;
}
+ /**
+ * Gets the work agent response topic.
+ *
+ * @return the work agent response topic.
+ */
public String getWorkAgentResponseTopic() {
return workAgentResponseTopic;
}
+ /**
+ * Sets the work agent response topic.
+ *
+ * @param workAgentResponseTopic the work agent response topic to set.
+ */
public void setWorkAgentResponseTopic(String workAgentResponseTopic) {
this.workAgentResponseTopic = workAgentResponseTopic;
}
+ /**
+ * Gets the work agent response group ID.
+ *
+ * @return the work agent response group ID.
+ */
public String getWorkAgentResponseGroupID() {
return workAgentResponseGroupID;
}
+ /**
+ * Sets the work agent response group ID.
+ *
+ * @param workAgentResponseGroupID the work agent response group ID to set.
+ */
public void setWorkAgentResponseGroupID(String workAgentResponseGroupID) {
this.workAgentResponseGroupID = workAgentResponseGroupID;
}
+ /**
+ * Gets the agent topic.
+ *
+ * @return the agent topic.
+ */
public String getAgentTopic() {
return agentTopic;
}
+ /**
+ * Sets the agent topic.
+ *
+ * @param agentTopic the agent topic to set.
+ */
public void setAgentTopic(String agentTopic) {
this.agentTopic = agentTopic;
}
+ /**
+ * Gets the access key.
+ *
+ * @return the access key.
+ */
public String getAccessKey() {
return accessKey;
}
+ /**
+ * Sets the access key.
+ *
+ * @param accessKey the access key to set.
+ */
public void setAccessKey(String accessKey) {
this.accessKey = accessKey;
}
+ /**
+ * Gets the agent URL.
+ *
+ * @return the agent URL.
+ */
public String getAgentUrl() {
return agentUrl;
}
+ /**
+ * Sets the agent URL.
+ *
+ * @param agentUrl the agent URL to set.
+ */
public void setAgentUrl(String agentUrl) {
this.agentUrl = agentUrl;
}
+ /**
+ * Sets the HTTP client.
+ *
+ * @param httpClient the HTTP client to set.
+ */
public void setHttpClient(A2AHttpClient httpClient) {
this.httpClient = httpClient;
}
+ /**
+ * Gets the lite topic.
+ *
+ * @return the lite topic.
+ */
public String getLiteTopic() {
return liteTopic;
}
+ /**
+ * Sets the lite topic.
+ *
+ * @param liteTopic the lite topic to set.
+ */
public void setLiteTopic(String liteTopic) {
this.liteTopic = liteTopic;
}
+ /**
+ * Checks if the default recover mode is enabled.
+ *
+ * @return true if the default recover mode is enabled, false otherwise.
+ */
public boolean isUseDefaultRecoverMode() {
return useDefaultRecoverMode;
}
+ /**
+ * Sets whether the default recover mode should be enabled.
+ *
+ * @param useDefaultRecoverMode true to enable the default recover mode,
false otherwise.
+ */
public void setUseDefaultRecoverMode(boolean useDefaultRecoverMode) {
this.useDefaultRecoverMode = useDefaultRecoverMode;
}
+ /**
+ * Creates a new builder instance for constructing RocketMQTransportConfig
objects.
+ *
+ * @return a new builder instance.
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Builder class for RocketMQTransportConfig.
+ */
public static class Builder {
private String accessKey;
private String secretKey;
@@ -220,61 +346,132 @@ public class RocketMQTransportConfig extends
ClientTransportConfig<RocketMQTrans
private boolean useDefaultRecoverMode = false;
private A2AHttpClient httpClient;
+ /**
+ * Sets the access key.
+ *
+ * @param accessKey the access key to set.
+ * @return the builder instance.
+ */
public Builder accessKey(String accessKey) {
this.accessKey = accessKey;
return this;
}
+ /**
+ * Sets the secret key.
+ *
+ * @param secretKey the secret key to set.
+ * @return the builder instance.
+ */
public Builder secretKey(String secretKey) {
this.secretKey = secretKey;
return this;
}
+ /**
+ * Sets the endpoint.
+ *
+ * @param endpoint the endpoint to set.
+ * @return the builder instance.
+ */
public Builder endpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}
+ /**
+ * Sets the namespace.
+ *
+ * @param namespace the namespace to set.
+ * @return the builder instance.
+ */
public Builder namespace(String namespace) {
this.namespace = namespace;
return this;
}
+ /**
+ * Sets the work agent response topic.
+ *
+ * @param workAgentResponseTopic the work agent response topic to set.
+ * @return the builder instance.
+ */
public Builder workAgentResponseTopic(String workAgentResponseTopic) {
this.workAgentResponseTopic = workAgentResponseTopic;
return this;
}
+ /**
+ * Sets the work agent response group ID.
+ *
+ * @param workAgentResponseGroupID the work agent response group ID to
set.
+ * @return the builder instance.
+ */
public Builder workAgentResponseGroupID(String
workAgentResponseGroupID) {
this.workAgentResponseGroupID = workAgentResponseGroupID;
return this;
}
+ /**
+ * Sets the agent topic.
+ *
+ * @param agentTopic the agent topic to set.
+ * @return the builder instance.
+ */
public Builder agentTopic(String agentTopic) {
this.agentTopic = agentTopic;
return this;
}
+ /**
+ * Sets the agent URL.
+ *
+ * @param agentUrl the agent URL to set.
+ * @return the builder instance.
+ */
public Builder agentUrl(String agentUrl) {
this.agentUrl = agentUrl;
return this;
}
+ /**
+ * Sets the lite topic.
+ *
+ * @param liteTopic the lite topic to set.
+ * @return the builder instance.
+ */
public Builder liteTopic(String liteTopic) {
this.liteTopic = liteTopic;
return this;
}
+ /**
+ * Sets whether the default recover mode should be enabled.
+ *
+ * @param useDefaultRecoverMode true to enable the default recover
mode, false otherwise.
+ * @return the builder instance.
+ */
public Builder useDefaultRecoverMode(boolean useDefaultRecoverMode) {
this.useDefaultRecoverMode = useDefaultRecoverMode;
return this;
}
+ /**
+ * Sets the HTTP client.
+ *
+ * @param httpClient the HTTP client to set.
+ * @return the builder instance.
+ */
public Builder httpClient(A2AHttpClient httpClient) {
this.httpClient = httpClient;
return this;
}
+ /**
+ * Builds a RocketMQTransportConfig instance with the configured
parameters.
+ *
+ * @return a new RocketMQTransportConfig instance.
+ */
public RocketMQTransportConfig build() {
// Use full constructor to ensure all fields are properly
initialized
RocketMQTransportConfig config = new RocketMQTransportConfig(
@@ -287,4 +484,3 @@ public class RocketMQTransportConfig extends
ClientTransportConfig<RocketMQTrans
}
}
}
-
diff --git
a/src/main/java/org/apache/rocketmq/a2a/transport/provider/RocketMQTransportProvider.java
b/src/main/java/org/apache/rocketmq/a2a/transport/provider/RocketMQTransportProvider.java
index 4f75d41..25ce14f 100644
---
a/src/main/java/org/apache/rocketmq/a2a/transport/provider/RocketMQTransportProvider.java
+++
b/src/main/java/org/apache/rocketmq/a2a/transport/provider/RocketMQTransportProvider.java
@@ -53,7 +53,7 @@ public class RocketMQTransportProvider implements
ClientTransportProvider<Rocket
/**
* Returns the protocol name associated with this transport provider.
*
- * @return the constant {@link #ROCKETMQ_PROTOCOL}, identifying the
RocketMQ-based A2A transport.
+ * @return the constant ROCKETMQ_PROTOCOL, identifying the RocketMQ-based
A2A transport.
*/
@Override
public String getTransportProtocol() {