springwolf-core icon indicating copy to clipboard operation
springwolf-core copied to clipboard

Display server per channel in springwolf-ui

Open stammaja opened this issue 1 year ago • 3 comments

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 avatar Apr 14 '24 20:04 stammaja

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.

github-actions[bot] avatar Apr 14 '24 20:04 github-actions[bot]

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 avatar Apr 19 '24 12:04 timonback

To better indicate in the ui the difference between protocol and server name, https://github.com/springwolf/springwolf-core/pull/738 updates the examples

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

timonback avatar May 01 '24 10:05 timonback

On this is being worked in https://github.com/springwolf/springwolf-core/pull/832

timonback avatar Jul 13 '24 07:07 timonback

The change is staged for release and will be part of the next release.

If you want to try and verify it in your application today, use the latest 1.X.0-SNAPSHOT build as described in our README.md > Testing SNAPSHOT version

Thank you for the report/contribution!

github-actions[bot] avatar Jul 26 '24 17:07 github-actions[bot]

The change is available in the latest release. 🎉

Thank you for the report/contribution and making Springwolf better!

github-actions[bot] avatar Aug 30 '24 16:08 github-actions[bot]