JSON RPC Protocol

This commit is contained in:
crusader 2017-12-09 17:45:07 +09:00
parent af055230e5
commit 55cf7944ed
3 changed files with 29 additions and 6 deletions

View File

@ -31,20 +31,43 @@ public class PublishMessage {
}
public static class PublishMessageBody {
private String method;
private List<String> params;
private String jsonrpc = "2.0";
private PublishMessageBodyNotification result;
public PublishMessageBody() {
this.result = new PublishMessageBodyNotification();
}
public PublishMessageBody(String method) {
this.method = method;
this();
this.result.setMethod(method);
}
public PublishMessageBody(String method, List<String> params) {
this(method);
this.params = params;
this.result.setParams(params);
}
public String getJsonrpc() {
return jsonrpc;
}
public void setJsonrpc(String jsonrpc) {
this.jsonrpc = jsonrpc;
}
public PublishMessageBodyNotification getResult() {
return result;
}
public void setResult(PublishMessageBodyNotification result) {
this.result = result;
}
}
public static class PublishMessageBodyNotification {
private String method;
private List<String> params;
public String getMethod() {
return method;
}
@ -67,5 +90,6 @@ public class PublishMessage {
}
this.params.add(param);
}
}
}

View File

@ -79,7 +79,6 @@ public class RedisMessagePublisher implements MessagePublisher {
return results;
}
protected void publish(final String channel, PublishMessage message, final String method, Object... params) {
ChannelTopic topic = this.topics.get(channel);
message.setMessage(new PublishMessage.PublishMessageBody(method, this.getMessageBody(params)));

View File

@ -1,4 +1,4 @@
datasource.url=jdbc:postgresql://192.168.1.209:5432/overflow
datasource.url=jdbc:postgresql://192.168.1.50:5432/overflow
datasource.username=overflow
datasource.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver