I've missed this part in configuration:

akka.kafka.consumer.kafka-clients {
  auto.offset.reset = "latest"
}


Default is "earliest" so consumer always starts from beginning, regardless of 
what I put for time in Subscriptions.assignmentOffsetsForTimes.


Zlaja

 

On Friday, September 22, 2017 at 12:06:40 AM UTC+2, Zlatko Josic wrote:
>
> Hi,
>
> How does exactly Subscriptions.assignmentOffsetsForTimes work?
>
> Should Consumer start getting messages from Kafka starting from offset 
> which corresponds to
> forwarded time in Subscriptions.assignmentOffsetsForTimes? 
>
> I have this part of code in Lagom:
>
> override def getLiveChanges(): ServiceCall[EsbIdsApi, Source[BookingEventApi, 
> NotUsed]] = ServiceCall { request =>
>
>   val esbIdsSet = request.esbIds.toSet
>
>   val time = System.currentTimeMillis()
>   val subscription = Subscriptions.assignmentOffsetsForTimes(
>     new TopicPartition("bookings", 0) -> time
>   )
>
>   val source = 
> Consumer.plainSource(consumerSettingsFactory.consumerSettings[BookingEventApi],
>  subscription)
>     .filter { item =>
>       esbIdsSet.contains(item.value.esbId)
>
>     }.map { item =>
>     item.value()
>   }
>   Future.successful(source.mapMaterializedValue(_ => NotUsed))
> }
>
>
> But I always get all messages from Kakfa's topic.
>
> Zlaja
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to