
com.alibaba.rsocket.events.ServicesHiddenEvent Maven / Gradle / Ivy
package com.alibaba.rsocket.events;
import com.alibaba.rsocket.RSocketAppContext;
import com.alibaba.rsocket.ServiceLocator;
import com.alibaba.rsocket.cloudevents.CloudEventImpl;
import com.alibaba.rsocket.cloudevents.RSocketCloudEventBuilder;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
* services hidden event: remove services from routing table
*
* @author leijuan
*/
public class ServicesHiddenEvent implements CloudEventSupport {
/**
* app UUID
*/
private String appId;
/**
* hidden services
*/
private Set services = new HashSet<>();
public ServicesHiddenEvent() {
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public Set getServices() {
return services;
}
public void setServices(Set services) {
this.services = services;
}
public void addService(ServiceLocator serviceLocator) {
this.services.add(serviceLocator);
}
public static CloudEventImpl convertServicesToCloudEvent(Collection serviceLocators) {
ServicesHiddenEvent servicesHiddenEvent = new ServicesHiddenEvent();
for (ServiceLocator serviceLocator : serviceLocators) {
servicesHiddenEvent.addService(serviceLocator);
}
servicesHiddenEvent.setAppId(RSocketAppContext.ID);
return RSocketCloudEventBuilder
.builder(servicesHiddenEvent)
.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy