I want to setup several categorized feeds to segment content being posted. I have 4 feeds setup for testing:
- user
- flat
- sports
- football
The user and flat feeds are working as expected from the docs using the Java API. I can post to the user feed and am able to retrieve items for that user from it. I can also follow a user and am seeing those be reflected in the flat feed.
The challenge I have is in segmenting content based on some simple tagging. I basically want to setup some public feeds and copy posts to those based on tag values. This is working and I am seeing posts duplicated across the sports and football feeds as expected. (Not using To becuase that seemed to break through the Java wrapper).
My issue is how to use the API to read everything in the feed and not just posts by a specific user?
Code to add the item to a categorized feed:
//Post this to the categorized feed
SimpleActivity activity = new SimpleActivity();
activity.setActor(item.getOwnerId());
activity.setObject(item.getId());
activity.setVerb(POST_VERB);
activity.setForeignId(item.getId());
Feed theFeed = this.streamClient.newFeed(theCategory, item.getOwnerId());
//Create an activity service
FlatActivityServiceImpl<SimpleActivity> flatActivityService = theFeed.newFlatActivityService(SimpleActivity.class);
//Add an activity to the feed, where actor, object and target are references to objects
try {
SimpleActivity response = flatActivityService.addActivity(activity);
//Lets log some info on this!
LOG.debug("Item added " + response.getForeignId());
} catch (IOException e) {
LOG.warn("IOException in StreamService", e);
} catch (StreamClientException e) {
LOG.warn("StreamClientException in StreamService", e);
}
And then reading it back
Feed theFeed = this.streamClient.newFeed(theFeedCategory.getFeedId(), userId);
FeedFilter filter = new FeedFilter.Builder().withLimit(pageSize).withOffset(start).build();
FlatActivityServiceImpl<SimpleActivity> flatActivityService = theFeed.newFlatActivityService(SimpleActivity.class);
try {
List<SimpleActivity> activities = flatActivityService.getActivities(filter).getResults();
for (SimpleActivity activity : activities) {
response.add(activity.getForeignId());
}
} catch (IOException e) {
LOG.warn("IOException in StreamService", e);
} catch (StreamClientException e) {
LOG.warn("StreamClientException in StreamService", e);
}
Is there a way I can go through the java API to get everything in a feed by any user OR is there a way to segment the feeds so they pivot on a category?
Thanks