@Override public NotificationFeedInfo getFeed(NotificationFeedId feed) throws NotificationFeedNotFoundException { return new NotificationFeedInfo(feed.getNamespace(), feed.getCategory(), feed.getFeed(), ""); }
@Override public boolean createFeed(NotificationFeedInfo feed) throws NotificationFeedException { String path = String.format("namespaces/%s/feeds/categories/%s/names/%s", feed.getNamespace(), feed.getCategory(), feed.getFeed()); HttpRequest request = remoteClient.requestBuilder(HttpMethod.PUT, path) .withBody(GSON.toJson(feed)).build(); HttpResponse response = execute(request); if (response.getResponseCode() == HttpURLConnection.HTTP_OK) { return true; } else if (response.getResponseCode() == HttpURLConnection.HTTP_CONFLICT) { return false; } throw new NotificationFeedException("Cannot create notification feed. Reason: " + response); }
NotificationFeedInfo streamHeartbeatsFeed = new NotificationFeedInfo( NamespaceId.SYSTEM.getEntityName(), Constants.Notification.Stream.STREAM_INTERNAL_FEED_CATEGORY,
/** * Create the public {@link NotificationFeedId}s that concerns the stream with configuration {@code config}. * * @param config config of the stream to create feeds for */ private void createStreamFeeds(StreamConfig config) { try { NotificationFeedInfo streamFeed = new NotificationFeedInfo( config.getStreamId().getNamespace(), Constants.Notification.Stream.STREAM_FEED_CATEGORY, String.format("%sSize", config.getStreamId().getEntityName()), String.format("Size updates feed for Stream %s every %dMB", config.getStreamId(), config.getNotificationThresholdMB())); notificationFeedManager.createFeed(streamFeed); } catch (NotificationFeedException e) { LOG.error("Cannot create feed for Stream {}", config.getStreamId(), e); } }
Map<String, String> body = parseBody(request, MAP_TYPE); String description = body == null ? null : body.get("description"); feedInfo = new NotificationFeedInfo(namespaceId, category, name, description); } catch (IllegalArgumentException e) { responder.sendString(HttpResponseStatus.BAD_REQUEST,