You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jay Kreps (JIRA)" <ji...@apache.org> on 2015/02/08 01:29:35 UTC

[jira] [Commented] (KAFKA-1897) Enhance MockProducer for more sophisticated tests

    [ https://issues.apache.org/jira/browse/KAFKA-1897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14311041#comment-14311041 ] 

Jay Kreps commented on KAFKA-1897:
----------------------------------

[~navina] WRT your suggestions:
1. Isn't this what the autoComplete option in the constructor does?
2. Rather than expose the Deque which can be misused you have access to completeNext() or errorNext() which allow you to concurrently invoke these.

It may be that in your code you need to invoke these from a separate thread, that will totally depend on the usage and test cases, but that should work.

I'm not sure if I fully understood the issue but currently I think we basically have the support you need, let me know if you agree and I'll close this or else very likely I am confused about the problem.

> Enhance MockProducer for more sophisticated tests
> -------------------------------------------------
>
>                 Key: KAFKA-1897
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1897
>             Project: Kafka
>          Issue Type: Bug
>          Components: producer 
>            Reporter: Navina Ramesh
>            Assignee: Jun Rao
>             Fix For: 0.8.2
>
>
> Based on the experience of upgrading the kafka producer in Samza, we faced two main constraints when using MockProducer: 
> 1. The constructor requires a cluster specification and the tools to create a test cluster is not exposed. It is available from TestUtils in Kafka, however that jar is not published. This issue is currently being addressed in KAFKA-1861.
> 2. No support for testing a blocking client call. For example, "flush" in Samza blocks on the future returned by the latest send request. In order to test this, the MockProducer which buffers it should run in a concurrent mode. There is currently no provision to do this. We want the MockProducer to buffer the send and then, complete the callback concurrently while we wait for "flush" to unblock. 
> We can write unit tests that have improved coverage if we can add support for concurrent execution of the MockProducer and unit test thread. For example implementation, please refer to the latest version of KafkaSystemProducer.scala in the Apache Samza repository.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)