This commit is contained in:
lxy
2020-11-30 09:25:23 +08:00
parent 9138790fd2
commit 10472078b0
4 changed files with 26 additions and 37 deletions

View File

@@ -42,7 +42,11 @@ public class RedisProducer<T extends Event> implements IProducer<T>, Service {
@Override
public void send(T t) {
try {
osw.write("PUBLISH " + t.topic + " '" + JsonConvert.root().convertTo(t.value) + "' \r\n");
String v = JsonConvert.root().convertTo(t.value);
if (v.startsWith("\"") && v.endsWith("\"")) {
v = v.substring(1, v.length() - 1);
}
osw.write("PUBLISH " + t.topic + " '" + v + "' \r\n");
osw.flush();
} catch (IOException e) {
logger.log(Level.WARNING, "", e);