2017-08-15 5 views
2

Stream Javaクライアントバージョン1.3.2を使用しています。GetStream-IO foreignIdのないアクティビティを複数のフィードに追加しますが、これらのアクティビティは同じIDを共有します

私はフラットcustomerフィードを持っています:customer:101,customer:102、およびcustomer103です。

フラットtimelineフィード、timeline:201もあり、これは上記の3つのフィードに続きます。

customer:101に活性を加えた。アクティビティのtoフィールドはcustomer:102customer:103に設定されています。

ここで、活性は3つのフィードにあり、フィードはtimelineフィードにあるはずです。

foreignIdおよびtimeフィールドは、そのアクティビティに設定されていません。同じアクティビティが異なるフィードに異なるidを持つと期待する必要がありますか?

私が活動にforeignIdtimeフィールドを設定しない場合は、別のフィードに同じ活性が異なるid秒を持っているだろうという印象の下にありました。しかし、それは私が今まで走っていたものからのケースではないようです。

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); 

私は次の出力ました:

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} 

が、これは正常な動作です

は、ここに私のコードのスニペットですか?私は彼らがすべて異なるidを持っていると思った。

答えて

0

これについての電話での混乱のお詫び。 Toフィールドを使用しているため、同じペイロードが各フィードに書き込まれます。同じペイロードが同じtimeフィールドにあるため、実際には同じアクティビティID値を持ちます。別々の呼び出しでアクティビティを記述した場合は、異なるアクティビティID値が与えられているはずです。 ONLYその1つのフィードから活動を削除する必要があります...

feedTwoService.deleteActivity('f3d6...824c'); 

活動のIDを使用して、削除を発行するには、しかし、その呼び出しのように、単一のフィードに固有のものです。

あなたforeign_id値を使用している場合、あなたは、元のフィードの削除呼び出しでforeign_idが、それはまた、フォローの関係を通じてコピーを持って任意のフィードから活動を削除することを使用、など

+0

感謝速い返事のためにイアン! –

+0

Iは同様に、アクティビティIDを使用して 'timeline'フィードから活動を削除する呼び出しを行った: ' timeline.deleteActivity( "f3d610da-81df-11e7-8080-80000cce824c"); ' I印刷する場合すべてのフィードの内容は、 'customer:101'フィードだけがそのアクティビティを含んでいます。他のフィードにはその活動が削除されているようです... 実際に何が起こっているのか分かりません。 あなたが言及したところから、私は3つの 'customer'フィードのすべてでアクティビティを見るべきであり、' timeline'アクティビティだけが空であるべきです。 –

関連する問題