Observable < ComapiResult < Void > > markDelivered ( String conversationId , Set < String > ids ) { final List < MessageStatusUpdate > updates = new ArrayList <> ( ) ; updates . add ( MessageStatusUpdate . builder ( ) . setMessagesIds ( ids ) . setStatus ( MessageStatus . delivered ) . setTimestamp ( DateHelper . getCurrentUTC ( ) ) . build ( ) ) ; return checkState ( ) . flatMap ( client -> client . service ( ) . messaging ( ) . updateMessageStatus ( conversationId , updates ) . retryWhen ( observable -> { return observable . zipWith ( Observable . range ( 1 , 3 ) , ( Func2 < Throwable , Integer , Integer > ) ( throwable , integer ) -> integer ) . flatMap ( new Func1 < Integer , Observable < Long > > ( ) { @ Override public Observable < Long > call ( Integer retryCount ) { return Observable . timer ( ( long ) Math . pow ( 1 , retryCount ) , TimeUnit . SECONDS ) ; } } ) ; } ) ) ; }
Mark messages in a conversations as delivered .