Got it working with this, still try to understand the last part (runForEach)




s.mapAsyncUnordered(3, new 
Function<Pair<TopicPartition,Source<CommittableMessage<SpecificRecord,SpecificRecord>,NotUsed>>,
 
CompletionStage<Done>>() {

public CompletionStage<Done> apply(
Pair<TopicPartition, 
Source<ConsumerMessage.CommittableMessage<SpecificRecord, SpecificRecord>, 
NotUsed>> param)
throws Exception {
System.out.println("----------------part -----------------" + 
param.first().partition());
   Source<Message<SpecificRecord, SpecificRecord, Committable>, NotUsed> f 
= 
    param.second().map(new 
Function<ConsumerMessage.CommittableMessage<SpecificRecord,SpecificRecord>, 
ProducerMessage.Message<SpecificRecord, SpecificRecord, 
ConsumerMessage.Committable>>() {

public ProducerMessage.Message<SpecificRecord, SpecificRecord, 
ConsumerMessage.Committable> apply(
CommittableMessage<SpecificRecord, SpecificRecord> msg)
throws Exception {
//System.out.println(Thread.currentThread().getName() + 
"msg---------------------------------------------------" + msg); 
System.out.println(Thread.currentThread().getName() + 
"msg---------------------------------------------------" + 
msg.record().value().getClass()); 
return new ProducerMessage.Message<SpecificRecord, SpecificRecord, 
ConsumerMessage.Committable>(
new ProducerRecord<SpecificRecord, SpecificRecord>("akkatest", 
msg.record().key(), msg.record().value()), msg.committableOffset());
}
});
 
   return f.runWith(Producer.commitableSink(producerSettings), 
materializer);
    
}
}).runForeach(new Procedure<Done>() {
@Override
public void apply(Done param) throws Exception {
}
}, materializer);

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