在通过设置以下属性启用绑定执行器端点后:management.endpoints.web.exposure.include=bindings
,我应该看到bindings(消费者)属性。
但是,在添加Spring Cloud Bus依赖项并启用Spring Cloud Bus之后,我只能看到springCloudBus的绑定属性,而看不到我在项目中创建的绑定。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
问题:如何确保启用Spring Cloud Bus后仍能看到创建的绑定?
设置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": {}
}
}
}
}
}
]
要复制的步骤:
设置spring.cloud.bus.enabled
执行curl -X GET http://localhost:9999/bindings