修改:zhub-client 重连逻辑

This commit is contained in:
lxy
2021-03-01 18:50:15 +08:00
parent 57c216c791
commit 895df0e05a
6 changed files with 77 additions and 65 deletions

View File

@@ -39,17 +39,18 @@ public class RedisProducer implements IProducer, Service {
}
@Override
public <V> void publish(String topic, V v) {
public boolean publish(String topic, Object v) {
try {
osw.write("PUBLISH " + topic + " '" + toStr(v) + "' \r\n");
osw.flush();
return true;
} catch (IOException e) {
logger.log(Level.WARNING, "", e);
}
return false;
}
private <V> String toStr(V v) {
private String toStr(Object v) {
if (v instanceof String) {
return (String) v;
}