GetStream-IO Add activity without foreignId to multiple feeds, but these activities share same Id

Viewed 370

I'm using the Stream Java client version 1.3.2.

I have three flat customer feeds: customer:101, customer:102, and customer103.

There is also a flat timeline feed, timeline:201, which follows the above three customer feeds.

I added an activity to customer:101. The activity has the to field set to customer:102 and customer:103.

The activity should now be in the three customer feeds and the timeline feed.

The foreignId and time fields are not set for that activity. Should I expect the same activity to have different ids in the different feeds?

I was under the impression that if I don't set the foreignId and time fields on an activity, the same activity on different feeds will have different ids. But that does not seem to be the case from what I ran so far.

Here's a snippet of my code:

Feed feedOne = streamClient.newFeed("customer", "101");
FlatActivityServiceImpl<SimpleActivity> feedOneService =
    feedOne.newFlatActivityService(SimpleActivity.class);

Feed feedTwo = streamClient.newFeed("customer", "102");
FlatActivityServiceImpl<SimpleActivity> feedTwoService =
    feedTwo.newFlatActivityService(SimpleActivity.class);

Feed feedThree = streamClient.newFeed("customer", "103");
FlatActivityServiceImpl<SimpleActivity> feedThreeService =
    feedThree.newFlatActivityService(SimpleActivity.class);

Feed timeline = streamClient.newFeed("timeline", "201");
FlatActivityServiceImpl<SimpleActivity> timelineService =
    timeline.newFlatActivityService(SimpleActivity.class);

timeline.follow("customer", "101", 0);
timeline.follow("customer", "102", 0);
timeline.follow("customer", "103", 0);

// Create a new activity
SimpleActivity activity = new SimpleActivity();
activity.setActor("customer:101");
activity.setObject("tweet:1");
activity.setVerb("tweet");
activity.setTo(Arrays.asList("customer:102", "customer:103"));
feedOneService.addActivity(activity);

System.out.println("Feed one activities:");
feedOneService.getActivities().getResults().forEach(System.out::println);

System.out.println("Feed two activities:");
feedTwoService.getActivities().getResults().forEach(System.out::println);

System.out.println("Feed Three activities:");
feedThreeService.getActivities().getResults().forEach(System.out::println);

System.out.println("Timeline activities:");
timelineService.getActivities().getResults().forEach(System.out::println);

I got the following output:

13:34:11.835 [main] DEBUG i.g.c.a.repo.StreamRepositoryImpl - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/timeline/201/following/?api_key=
13:34:12.323 [main] DEBUG i.g.c.a.repo.StreamRepositoryImpl - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/timeline/201/following/?api_key=
13:34:12.433 [main] DEBUG i.g.c.a.repo.StreamRepositoryImpl - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/timeline/201/following/?api_key=
13:34:12.573 [main] DEBUG i.g.c.a.r.StreamActivityRepository - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/customer/101/?api_key='
Feed one activities:
13:34:12.817 [main] DEBUG i.g.c.a.r.StreamActivityRepository - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/customer/101/?api_key=w&limit=25'
SimpleActivity{id=f3d610da-81df-11e7-8080-80000cce824c, actor=customer:101, verb=tweet, object=tweet:1, target=null, time=Tue Aug 15 13:34:12 EDT 2017, to=[customer:102, customer:103], origin=null, score=null, duration=null}
Feed two activities:
13:34:12.892 [main] DEBUG i.g.c.a.r.StreamActivityRepository - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/customer/102/?api_key=w&limit=25'
SimpleActivity{id=f3d610da-81df-11e7-8080-80000cce824c, actor=customer:101, verb=tweet, object=tweet:1, target=null, time=Tue Aug 15 13:34:12 EDT 2017, to=[customer:102, customer:103], origin=null, score=null, duration=null}
Feed Three activities:
13:34:12.963 [main] DEBUG i.g.c.a.r.StreamActivityRepository - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/customer/103/?api_key=&limit=25'
SimpleActivity{id=f3d610da-81df-11e7-8080-80000cce824c, actor=customer:101, verb=tweet, object=tweet:1, target=null, time=Tue Aug 15 13:34:12 EDT 2017, to=[customer:102, customer:103], origin=customer:102, score=null, duration=null}
Timeline activities: 
13:34:13.012 [main] DEBUG i.g.c.a.r.StreamActivityRepository - Invoking url: 'https://us-east-api.getstream.io/api/v1.0/feed/timeline/201/?api_key=&limit=25'
SimpleActivity{id=f3d610da-81df-11e7-8080-80000cce824c, actor=customer:101, verb=tweet, object=tweet:1, target=null, time=Tue Aug 15 13:34:12 EDT 2017, to=[customer:102, customer:103], origin=customer:103, score=null, duration=null}

Is this the expected behavior? I expected them to all have different ids.

1 Answers
Related