Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Producer cannot receive new topic #2

Closed
adyliu opened this issue May 26, 2012 · 1 comment
Closed

Producer cannot receive new topic #2

adyliu opened this issue May 26, 2012 · 1 comment
Labels

Comments

@adyliu
Copy link
Owner

adyliu commented May 26, 2012

Producer sends some messages with new topic(not registed at broker).

The producer processes the partitions changing incorrectly if the broker creates this topic more than one partition.

See the code(https://github.com/adyliu/jafka/blob/v1.0/src/main/java/com/sohu/jafka/producer/ZKBrokerPartitionInfo.java):

class BrokerTopicsListener implements IZkChildListener {

    private Map<String, SortedSet<Partition>> originalBrokerTopicsParitions;

    private Map<Integer, Broker> originBrokerIds;

    public BrokerTopicsListener(Map<String, SortedSet<Partition>> originalBrokerTopicsParitions, Map<Integer, Broker> originBrokerIds) {
        super();
        this.originalBrokerTopicsParitions = originalBrokerTopicsParitions;
        this.originBrokerIds = originBrokerIds;

We need a new map before the producer creating a default partition for new topic.

    public BrokerTopicsListener(Map<String, SortedSet<Partition>> originalBrokerTopicsParitions,
            Map<Integer, Broker> originBrokerIds) {
        super();
        this.originalBrokerTopicsParitions = new HashMap<String, SortedSet<Partition>>(
                originalBrokerTopicsParitions);
        this.originBrokerIds = new HashMap<Integer, Broker>(originBrokerIds);
@adyliu
Copy link
Owner Author

adyliu commented May 26, 2012

Fixed at 1.1: 4cf4b0d

@adyliu adyliu closed this as completed May 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant