Spring Cloud Stream 绑定可视化

Spring Cloud Stream binding visualisation

在我通过设置以下 属性 启用绑定执行器端点后:management.endpoints.web.exposure.include=bindings,我应该看到绑定(消费者)属性。

但是,在我添加 spring 云总线依赖项并启用 spring 云总线之后,我只能看到 springCloudBus 的绑定属性,但看不到我在我的项目。

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>

问题:如何确保我们在启用 spring 云总线后仍然可以看到我们创建的绑定?

当我设置spring.cloud.bus.enabled=false时,我得到了以下结果

[
    {
        "name": "TestInput",
        "group": null,
        "pausable": true,
        "state": "running",
        "extendedInfo": {
            "bindingDestination": "KafkaConsumerDestination{consumerDestinationName='TestInput', partitions=1, dlqName='null'}",
            "ExtendedConsumerProperties": {
                "concurrency": 1,
                "instanceCount": 1,
                "maxAttempts": 3,
                "backOffInitialInterval": 1000,
                "backOffMaxInterval": 10000,
                "backOffMultiplier": 2,
                "extension": {
                    "ackEachRecord": false,
                    "autoRebalanceEnabled": true,
                    "autoCommitOffset": true,
                    "autoCommitOnError": null,
                    "startOffset": null,
                    "resetOffsets": false,
                    "enableDlq": false,
                    "dlqName": null,
                    "dlqProducerProperties": {
                        "bufferSize": 16384,
                        "compressionType": "none",
                        "sync": false,
                        "batchTimeout": 0,
                        "messageKeyExpression": null,
                        "headerPatterns": null,
                        "configuration": {},
                        "admin": {
                            "replicationFactor": null,
                            "replicasAssignments": {},
                            "configuration": {}
                        }
                    },
                    "recoveryInterval": 5000,
                    "trustedPackages": null,
                    "standardHeaders": "none",
                    "converterBeanName": null,
                    "idleEventInterval": 30000,
                    "configuration": {},
                    "admin": {
                        "replicationFactor": null,
                        "replicasAssignments": {},
                        "configuration": {}
                    }
                }
            }
        }
    },
    {
        "name": "TestInput2",
        "group": null,
        "pausable": true,
        "state": "running",
        "extendedInfo": {
            "bindingDestination": "KafkaConsumerDestination{consumerDestinationName='TestInput2', partitions=1, dlqName='null'}",
            "ExtendedConsumerProperties": {
                "concurrency": 1,
                "instanceCount": 1,
                "maxAttempts": 3,
                "backOffInitialInterval": 1000,
                "backOffMaxInterval": 10000,
                "backOffMultiplier": 2,
                "extension": {
                    "ackEachRecord": false,
                    "autoRebalanceEnabled": true,
                    "autoCommitOffset": true,
                    "autoCommitOnError": null,
                    "startOffset": null,
                    "resetOffsets": false,
                    "enableDlq": false,
                    "dlqName": null,
                    "dlqProducerProperties": {
                        "bufferSize": 16384,
                        "compressionType": "none",
                        "sync": false,
                        "batchTimeout": 0,
                        "messageKeyExpression": null,
                        "headerPatterns": null,
                        "configuration": {},
                        "admin": {
                            "replicationFactor": null,
                            "replicasAssignments": {},
                            "configuration": {}
                        }
                    },
                    "recoveryInterval": 5000,
                    "trustedPackages": null,
                    "standardHeaders": "none",
                    "converterBeanName": null,
                    "idleEventInterval": 30000,
                    "configuration": {},
                    "admin": {
                        "replicationFactor": null,
                        "replicasAssignments": {},
                        "configuration": {}
                    }
                }
            }
        }
    }
]

设置spring.cloud.bus.enabled=true后,我只能看到springCloudBus

的属性
[
{
    "name": "springCloudBus",
    "group": null,
    "pausable": true,
    "state": "running",
    "extendedInfo": {
        "bindingDestination": "KafkaConsumerDestination{consumerDestinationName='springCloudBus', partitions=1, dlqName='null'}",
        "ExtendedConsumerProperties": {
            "concurrency": 1,
            "instanceCount": 1,
            "maxAttempts": 3,
            "backOffInitialInterval": 1000,
            "backOffMaxInterval": 10000,
            "backOffMultiplier": 2,
            "extension": {
                "ackEachRecord": false,
                "autoRebalanceEnabled": true,
                "autoCommitOffset": true,
                "autoCommitOnError": null,
                "startOffset": null,
                "resetOffsets": false,
                "enableDlq": false,
                "dlqName": null,
                "dlqProducerProperties": {
                    "bufferSize": 16384,
                    "compressionType": "none",
                    "sync": false,
                    "batchTimeout": 0,
                    "messageKeyExpression": null,
                    "headerPatterns": null,
                    "configuration": {},
                    "admin": {
                        "replicationFactor": null,
                        "replicasAssignments": {},
                        "configuration": {}
                    }
                },
                "recoveryInterval": 5000,
                "trustedPackages": null,
                "standardHeaders": "none",
                "converterBeanName": null,
                "idleEventInterval": 30000,
                "configuration": {},
                "admin": {
                    "replicationFactor": null,
                    "replicasAssignments": {},
                    "configuration": {}
                }
            }
        }
    }
}
]

复制步骤:

  1. https://github.com/HLTan94/SpringCloudStreamBindingsDemo

  2. 克隆项目
  3. 设置spring.cloud.bus.enabled

  4. 执行curl -X GET http://localhost:9999/bindings

我能够重现它并发现这实际上是我们这边的一个错误。您可以跟踪它 here。无论如何,我们应该在 7 月底之前发布服务版本(即 2.0.2)