puniverse / comsat

Fibers and actors for web development
docs.paralleluniverse.co/comsat
Other
598 stars 103 forks source link

Add fiber implementation for Kafka producer client #41

Closed Tim-Brooks closed 8 years ago

Tim-Brooks commented 8 years ago

I was playing around with Comsat and Quasar this weekend to checkout the current state of development.

I wanted to to try an implementation, and created (what I think) is a working implementation of the Kafka producer. I started on a consumer implementation, but the current release Kafka "newer" consumer is unstable and the interface will change noticeably in the next release. So I thought I would hold off on that.

I thought I would submit this pull request in case this functionality of interest.

pron commented 8 years ago

Hi, and thank you very much! Am I to understand correctly that the only change is returning a Future that can be joined by a fiber?

Tim-Brooks commented 8 years ago

Yeah. The Kafka Producer is already asynchronous with an io thread flushing the messages in the background. The future is completed whenever the send completes with a configurable number of acks.

It seemed to me, based on other examples, that making it compatible with Quasar only required integrated with the SettableFuture.

pron commented 8 years ago

Yep. Looks good. Could you perhaps add a test that actually joins the future in a fiber?

Tim-Brooks commented 8 years ago

Yeah. I'll rework the tests a bit later to test that.

Tim-Brooks commented 8 years ago

In the most recent commit, I modified the tests so that the futures were being joined inside a fiber.

pron commented 8 years ago

Very good. Thank you very much!