删除:producer 的 send 方法

This commit is contained in:
lxy 2021-01-23 19:01:50 +08:00
parent 3e91d785e3
commit f4ed1b05d0
5 changed files with 2 additions and 33 deletions

View File

@ -5,8 +5,5 @@ import java.util.logging.Logger;
public interface IProducer {
Logger logger = Logger.getLogger(IProducer.class.getSimpleName());
@Deprecated
<T extends Event> void send(T t);
<V> void publish(String topic, V v);
}

View File

@ -35,9 +35,6 @@ public abstract class KafakConsumer extends AbstractConsumer implements IConsume
protected Properties props;
// 0:none 1:restart -1:stop
//private int cmd = -1;
public abstract String getGroupid();
private final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();

View File

@ -40,7 +40,7 @@ public class KafakProducer implements IProducer, Service {
}
}
@Deprecated
/*@Deprecated
@Override
public <T extends Event> void send(T t) {
String v = JsonConvert.root().convertTo(t.value);
@ -48,7 +48,7 @@ public class KafakProducer implements IProducer, Service {
v = v.substring(1, v.length() - 1);
}
producer.send(new ProducerRecord(t.topic, v));
}
}*/
@Override
public <V> void publish(String topic, V v) {

View File

@ -39,22 +39,6 @@ public class RedisProducer implements IProducer, Service {
}
}
@Deprecated
@Override
public <T extends Event> void send(T t) {
try {
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);
}
}
@Override
public <V> void publish(String topic, V v) {
try {

View File

@ -138,15 +138,6 @@ public abstract class ZHubClient extends AbstractConsumer implements IConsumer,
return JsonConvert.root().convertTo(v);
}
@Deprecated
public void send(Event t) {
String v = JsonConvert.root().convertTo(t.value);
if (v.startsWith("\"") && v.endsWith("\"")) {
v = v.substring(1, v.length() - 1);
}
send("publish", t.topic, v);
}
public boolean initSocket() {
try {
client = new Socket();