This commit is contained in:
Redkale
2020-06-02 23:18:36 +08:00
parent 9cd9a8d3ea
commit 383ef37989
2 changed files with 50 additions and 1 deletions

View File

@@ -40,6 +40,8 @@ public abstract class MessageAgent {
protected MessageProducer producer;
protected MessageConsumer sncpRespConsumer;
//本地Service消息接收处理器 key:topic
protected ConcurrentHashMap<String, Service> localConsumers;
@@ -120,6 +122,11 @@ public abstract class MessageAgent {
return "sncp:resp:node" + nodeid;
}
//格式: http:req:user
public String generateHttpReqTopic(String module) {
return "http:req:" + module.toLowerCase();
}
//格式: http:req:user
protected String generateHttpReqTopic(Service service) {
String resname = Sncp.getResourceName(service);
@@ -132,7 +139,7 @@ public abstract class MessageAgent {
}
//格式: ws:resp:wsgame
protected String generateWebSocketRespTopic(WebSocketNode node) {
public String generateWebSocketRespTopic(WebSocketNode node) {
return "ws:resp:" + node.getName();
}

View File

@@ -46,6 +46,48 @@ public class HttpSimpleRequest implements java.io.Serializable {
@Comment("http body信息")
protected byte[] body; //对应HttpRequest.array
public HttpSimpleRequest requestURI(String requestURI) {
this.requestURI = requestURI;
return this;
}
public HttpSimpleRequest remoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr;
return this;
}
public HttpSimpleRequest sessionid(String sessionid) {
this.sessionid = sessionid;
return this;
}
public HttpSimpleRequest headers(Map<String, String> headers) {
this.headers = headers;
return this;
}
public HttpSimpleRequest params(Map<String, String> params) {
this.params = params;
return this;
}
public HttpSimpleRequest header(String key, String value) {
if (this.headers == null) this.headers = new HashMap<>();
this.headers.put(key, value);
return this;
}
public HttpSimpleRequest param(String key, String value) {
if (this.params == null) this.params = new HashMap<>();
this.params.put(key, value);
return this;
}
public HttpSimpleRequest body(byte[] body) {
this.body = body;
return this;
}
public HttpSimpleRequest clearParams() {
this.params = null;
return this;