In my testing i got this simple source->map->sink working, 

Source<CommittableMessage<SpecificRecord, SpecificRecord>, Control> s = 
Consumer.committableSource(consumerSettings, 
Subscriptions.topics("sanitation")).asJava();
s.map(new 
Function<ConsumerMessage.CommittableMessage<SpecificRecord,SpecificRecord>, 
ProducerMessage.Message<SpecificRecord,SpecificRecord, 
ConsumerMessage.Committable>>() {

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




now i want to test parallel by partition, i dont know what to put in the 
CompletionStage, can someone help or point me some doc/examples?


TopicPartition par = new TopicPartition("test", 3);

Source<Tuple2<TopicPartition, 
akka.stream.scaladsl.Source<CommittableMessage<SpecificRecord, 
SpecificRecord>, NotUsed>>, Control> s 
= Consumer.committablePartitionedSource(consumerSettings, 
Subscriptions.topics("test")).asJava();
s.mapAsync(3, new 
Function<Tuple2<TopicPartition,Source<CommittableMessage<SpecificRecord,SpecificRecord>,NotUsed>>,
 
CompletionStage<ProducerMessage.Message<SpecificRecord,SpecificRecord, 
ConsumerMessage.Committable>>>() {

public CompletionStage<Message<SpecificRecord, SpecificRecord, 
Committable>> apply(
Tuple2<TopicPartition, Source<CommittableMessage<SpecificRecord, 
SpecificRecord>, NotUsed>> param)
throws Exception {
// TODO Auto-generated method stub
return null;
}

});

Thanks
Shannon

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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