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

Having multiple listeners for a Kafka service is giving compiler error #7495

Open
TharmiganK opened this issue Jan 8, 2025 · 0 comments
Open

Comments

@TharmiganK
Copy link
Contributor

Description

$Subject

Steps to Reproduce

listener kafka:Listener orderListener = new (kafka:DEFAULT_URL, {
    groupId: "order-group-id",
    topics: "order-topic"
});

listener kafka:Listener inventoryListener = new (kafka:DEFAULT_URL, {
    groupId: "inventory-group-id",
    topics: "inventory-topic"
});

service on orderListener, inventoryListener {
    remote function onConsumerRecord(Order[] orders) {
    }
}

Compiler error:

Multiple listener attachments. Only one kafka:Listener is allowed.(KAFKA_110)

But this works:

listener kafka:Listener orderListener = new (kafka:DEFAULT_URL, {
    groupId: "order-group-id",
    topics: "order-topic"
});

listener kafka:Listener inventoryListener = new (kafka:DEFAULT_URL, {
    groupId: "inventory-group-id",
    topics: "inventory-topic"
});

service on orderListener {
    remote function onConsumerRecord(kafka:AnydataConsumerRecord[] recs) {
    }
}

service on inventoryListener {
    remote function onConsumerRecord(kafka:AnydataConsumerRecord[] recs) {
    }
}

But both of them are functionality wise same

Version

Ballerina SwanLake Update 11

Environment Details (with versions)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant