use of com.alibaba.nacos.naming.push.v2.PushDataWrapper in project nacos by alibaba.
the class PushExecutorDelegateTest method setUp.
@Before
public void setUp() throws Exception {
serviceMetadata = new ServiceMetadata();
pushdata = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S"));
delegate = new PushExecutorDelegate(pushExecutorRpc, pushExecutorUdp);
}
use of com.alibaba.nacos.naming.push.v2.PushDataWrapper in project nacos by alibaba.
the class PushExecuteTask method generatePushData.
private PushDataWrapper generatePushData() {
ServiceInfo serviceInfo = delayTaskEngine.getServiceStorage().getPushData(service);
ServiceMetadata serviceMetadata = delayTaskEngine.getMetadataManager().getServiceMetadata(service).orElse(null);
return new PushDataWrapper(serviceMetadata, serviceInfo);
}
use of com.alibaba.nacos.naming.push.v2.PushDataWrapper in project nacos by alibaba.
the class PushExecuteTask method run.
@Override
public void run() {
try {
PushDataWrapper wrapper = generatePushData();
ClientManager clientManager = delayTaskEngine.getClientManager();
for (String each : getTargetClientIds()) {
Client client = clientManager.getClient(each);
if (null == client) {
// means this client has disconnect
continue;
}
Subscriber subscriber = clientManager.getClient(each).getSubscriber(service);
delayTaskEngine.getPushExecutor().doPushWithCallback(each, subscriber, wrapper, new NamingPushCallback(each, subscriber, wrapper.getOriginalData(), delayTask.isPushToAll()));
}
} catch (Exception e) {
Loggers.PUSH.error("Push task for service" + service.getGroupedServiceName() + " execute failed ", e);
delayTaskEngine.addTask(service, new PushDelayTask(service, 1000L));
}
}
use of com.alibaba.nacos.naming.push.v2.PushDataWrapper in project nacos by alibaba.
the class PushExecutorRpcImplTest method setUp.
@Before
public void setUp() throws Exception {
serviceMetadata = new ServiceMetadata();
pushData = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S"));
pushExecutor = new PushExecutorRpcImpl(pushService);
doAnswer(new CallbackAnswer()).when(pushService).pushWithCallback(eq(rpcClientId), any(NotifySubscriberRequest.class), eq(pushCallBack), eq(GlobalExecutor.getCallbackExecutor()));
}
use of com.alibaba.nacos.naming.push.v2.PushDataWrapper in project nacos by alibaba.
the class PushExecutorUdpImplTest method setUp.
@Before
public void setUp() throws Exception {
serviceMetadata = new ServiceMetadata();
pushData = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S"));
pushExecutor = new PushExecutorUdpImpl(pushService);
doAnswer(new CallbackAnswer()).when(pushService).pushDataWithCallback(eq(subscriber), any(ServiceInfo.class), eq(pushCallBack));
}
Aggregations