@RequestMapping( value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public EventEndpoint getEventEndpoint( @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { return eventManagement.query(id, projectId); }
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List<EventEndpoint> getEventEndpoints( @RequestHeader(value = "project-id") String projectId) { List<EventEndpoint> eventEndpoints = new ArrayList<>(); eventManagement.queryByProjectId(projectId).forEach(eventEndpoints::add); eventManagement.queryByProjectId("*").forEach(eventEndpoints::add); return eventEndpoints; }
private EventEndpoint saveEventEndpoint(EventEndpoint endpoint) { EventEndpoint save = eventEndpointRepository.save(endpoint); log.info("Registered event endpoint" + save); eventManagement.removeUnreachableEndpoints(); return save; }
@Override @RabbitListener( bindings = @QueueBinding( value = @Queue( value = RabbitConfiguration.QUEUE_NAME_EVENT_UNREGISTER, durable = RabbitConfiguration.QUEUE_DURABLE, autoDelete = RabbitConfiguration.QUEUE_AUTODELETE), exchange = @Exchange( value = RabbitConfiguration.EXCHANGE_NAME_OPENBATON, ignoreDeclarationExceptions = "true", type = RabbitConfiguration.EXCHANGE_TYPE_OPENBATON, durable = RabbitConfiguration.EXCHANGE_DURABLE_OPENBATON), key = RabbitConfiguration.QUEUE_NAME_EVENT_UNREGISTER)) public void unregister(String id) throws NotFoundException { eventManagement.removeUnreachableEndpoints(); EventEndpoint endpoint = eventEndpointRepository.findFirstById(id); if (endpoint == null) throw new NotFoundException("No event found with ID " + id); log.info("Removing EventEndpoint with id: " + id); eventEndpointRepository.delete(id); } }
|| r.getProject() .equals( eventManagement.query(endpoint.getProjectId(), projectId).getId()); } catch (NotFoundException e) { e.printStackTrace();