@Override public void unregister(String id) throws NotFoundException { if (eventEndpointRepository.exists(id)) { log.info("Removing EventEndpoint with id: " + id); eventEndpointRepository.delete(id); } }
@Override public void dispatchEvent(EventNFVO event) { log.debug("dispatching event to the world!!!"); log.debug("event is: " + event); Iterable<EventEndpoint> endpoints = eventEndpointRepository.findAll(); for (EventEndpoint endpoint : endpoints) { log.debug("Checking endpoint: " + endpoint); if (endpoint.getEvent().ordinal() == event.getEventNFVO().getAction().ordinal()) { if (endpoint.getVirtualNetworkFunctionId() != null) { if (event.getEventNFVO().getPayload() instanceof VirtualNetworkFunctionRecord) { if (((VirtualNetworkFunctionRecord) event.getEventNFVO().getPayload()) .getId() .equals(endpoint.getVirtualNetworkFunctionId())) { log.debug("dispatching event to: " + endpoint); sendEvent(endpoint, event.getEventNFVO()); } } } else if (endpoint.getNetworkServiceId() != null) { if (event.getEventNFVO().getPayload() instanceof NetworkServiceRecord) { if (((NetworkServiceRecord) event.getEventNFVO().getPayload()) .getId() .equals(endpoint.getNetworkServiceId())) { log.debug("dispatching event to: " + endpoint); sendEvent(endpoint, event.getEventNFVO()); } } } else { log.debug("dispatching event to: " + endpoint); sendEvent(endpoint, event.getEventNFVO()); } } } }
public EventEndpoint saveEventEndpoint(EventEndpoint endpoint) { EventEndpoint save = eventEndpointRepository.save(endpoint); log.info("Registered event endpoint" + save); return save; }