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

Display server per channel in springwolf-ui #700

Open
1 task
stammaja opened this issue Apr 14, 2024 · 3 comments
Open
1 task

Display server per channel in springwolf-ui #700

stammaja opened this issue Apr 14, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@stammaja
Copy link

stammaja commented Apr 14, 2024

In a setup similar to your example ExampleClassLevelKafkaListener, I tried to use KafkaAsyncOperationBinding "type" in order to separate listeners per server they listen to. But I'm getting "kafka" instead.

springwolf-kafka version 1.1.0.

@KafkaListener(topics = "${push-api.topic}", groupId = "${push-api.topic.consumer-group}")
public class PushApiListener {

    @KafkaHandler
    @KafkaAsyncOperationBinding(
            type = "kafka-external"
    )
    public void handleNotification(NotificationDto notification) {
        ...
    }
springwolf.docket.servers.kafka-external.protocol=kafka-secure
springwolf.docket.servers.kafka-external.host=...

Expected: In the UI listener will be shown with tag "kafka-external"
Actual: It is shown still as "kafka"


EDIT by maintainer:

Requested enhancement:

  • Display the server name in springwolf-ui. A starting point can be channels.component.html. This can be a simple tag next to the protocol badge.

According to the spec, a server can be present on the channel kafka-example. If not present, the channel is available on all servers defined in the servers block.

You, or anybody who is interested, is welcome to contribute.

@stammaja stammaja added the bug Something isn't working label Apr 14, 2024
Copy link

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

@timonback
Copy link
Member

timonback commented Apr 19, 2024

Hi @stammaja,

that is a great feature enhancement to show in springwolf-ui the server for each found channel (kafka topic in your case).


Using your example, you probably want to configure it, so that the server name is kafka-external:

springwolf.docket.servers.kafka-external.protocol=kafka
springwolf.docket.servers.kafka-external.host=...

Also, your listener needs to know about the server name. You can use the @AsyncOperation annotation for that:

    @KafkaHandler
    @AsyncListener(
            operation =
                    @AsyncOperation(
                            channelName = TOPIC,
                            servers = {"kafka-external"}))
    public void handleNotification(NotificationDto notification) {
        //        ...
    }

(We plan to remove the type field as it is constant for the protocol name (kafka) and should not be modified)

Now, the server name shows up correctly in the asyncapi.json file.

@timonback timonback added enhancement New feature or request and removed bug Something isn't working labels Apr 19, 2024
@timonback timonback changed the title @KafkaAsyncOperationBinding "type" doesn't work in case of using it with @KafkaHandler Display server per channel in springwolf-ui Apr 19, 2024
@sam0r040 sam0r040 added the good first issue Good for newcomers label Apr 19, 2024
@timonback
Copy link
Member

To better indicate in the ui the difference between protocol and server name, #738 updates the examples

Help is still welcome to show the server name as part of the channel item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants