This commit is contained in:
@@ -40,6 +40,8 @@ public abstract class MessageAgent {
|
|||||||
|
|
||||||
protected MessageProducer producer;
|
protected MessageProducer producer;
|
||||||
|
|
||||||
|
protected MessageConsumer sncpRespConsumer;
|
||||||
|
|
||||||
//本地Service消息接收处理器, key:topic
|
//本地Service消息接收处理器, key:topic
|
||||||
protected ConcurrentHashMap<String, Service> localConsumers;
|
protected ConcurrentHashMap<String, Service> localConsumers;
|
||||||
|
|
||||||
@@ -120,6 +122,11 @@ public abstract class MessageAgent {
|
|||||||
return "sncp:resp:node" + nodeid;
|
return "sncp:resp:node" + nodeid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//格式: http:req:user
|
||||||
|
public String generateHttpReqTopic(String module) {
|
||||||
|
return "http:req:" + module.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
//格式: http:req:user
|
//格式: http:req:user
|
||||||
protected String generateHttpReqTopic(Service service) {
|
protected String generateHttpReqTopic(Service service) {
|
||||||
String resname = Sncp.getResourceName(service);
|
String resname = Sncp.getResourceName(service);
|
||||||
@@ -132,7 +139,7 @@ public abstract class MessageAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//格式: ws:resp:wsgame
|
//格式: ws:resp:wsgame
|
||||||
protected String generateWebSocketRespTopic(WebSocketNode node) {
|
public String generateWebSocketRespTopic(WebSocketNode node) {
|
||||||
return "ws:resp:" + node.getName();
|
return "ws:resp:" + node.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,48 @@ public class HttpSimpleRequest implements java.io.Serializable {
|
|||||||
@Comment("http body信息")
|
@Comment("http body信息")
|
||||||
protected byte[] body; //对应HttpRequest.array
|
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() {
|
public HttpSimpleRequest clearParams() {
|
||||||
this.params = null;
|
this.params = null;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user