通用订阅器添加 compile 方法定义
This commit is contained in:
parent
1c280ef64f
commit
7b3f2a57a2
@ -19,6 +19,8 @@ public interface GenericSubscribe<T> {
|
||||
void addSubscribe(String key,Flow.Subscriber<T> subscribe);
|
||||
void delPublisher(String key);
|
||||
|
||||
void compile(String key);
|
||||
|
||||
class Helper {
|
||||
public final static String SEPARATOR = ":";
|
||||
public static String getKey(String prefix,String... ids){
|
||||
|
@ -30,6 +30,10 @@ public class InviteSubscribe implements GenericSubscribe<SIPResponse> {
|
||||
Helper.addSubscribe(publishers, key, subscribe);
|
||||
}
|
||||
|
||||
public void compile(String key){
|
||||
delPublisher(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPublisher(String key) {
|
||||
Helper.delPublisher(publishers, key);
|
||||
|
@ -30,6 +30,10 @@ public class RecordInfoSubscribe implements GenericSubscribe<RecordInfoResponseD
|
||||
Helper.addSubscribe(publishers, key, subscribe);
|
||||
}
|
||||
|
||||
public void compile(String key){
|
||||
delPublisher(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPublisher(String key) {
|
||||
Helper.delPublisher(publishers, key);
|
||||
|
@ -33,6 +33,10 @@ public class SipRequestSubscribe implements GenericTimeoutSubscribe<SIPRequest>,
|
||||
Helper.addSubscribe(publishers, key, subscribe);
|
||||
}
|
||||
|
||||
public void compile(String key){
|
||||
delPublisher(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPublisher(String key) {
|
||||
ScheduledFuture<?> schedule = scheduledFutureManager.remove(key);
|
||||
|
@ -33,6 +33,10 @@ public class SipResponseSubscribe implements GenericTimeoutSubscribe<SIPResponse
|
||||
Helper.addSubscribe(publishers, key, subscribe);
|
||||
}
|
||||
|
||||
public void compile(String key){
|
||||
delPublisher(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delPublisher(String key) {
|
||||
ScheduledFuture<?> schedule = scheduledFutureManager.remove(key);
|
||||
|
@ -85,7 +85,7 @@ public class CatalogService {
|
||||
data.addAll(catalogResponseDTO.getDeviceList().getDeviceList());
|
||||
if(curNum >= sumNum){
|
||||
log.info("获取完成 {}", key);
|
||||
subscribe.getSipRequestSubscribe().delPublisher(key);
|
||||
subscribe.getSipRequestSubscribe().compile(key);
|
||||
} else {
|
||||
subscription.request(1);
|
||||
}
|
||||
@ -100,6 +100,7 @@ public class CatalogService {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
log.info("{} 返回结果 {}", key, result.complete(data));
|
||||
subscribe.getSipRequestSubscribe().delPublisher(key);
|
||||
}
|
||||
});
|
||||
provider.sendRequest(request);
|
||||
|
Loading…
Reference in New Issue
Block a user