Spring Cloud Stream 绑定可视化

     2023-02-16     121

关键词:

【中文标题】Spring Cloud Stream 绑定可视化【英文标题】:Spring Cloud Stream binding visualisation 【发布时间】:2018-12-24 17:35:30 【问题描述】:

通过设置以下属性启用绑定执行器端点后:management.endpoints.web.exposure.include=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": "KafkaConsumerDestinationconsumerDestinationName='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": "KafkaConsumerDestinationconsumerDestinationName='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": "KafkaConsumerDestinationconsumerDestinationName='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": 
                
            
        
    

]

复制步骤:

    从https://github.com/HLTan94/SpringCloudStreamBindingsDemo克隆项目

    设置spring.cloud.bus.enabled

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

【问题讨论】:

你的意思是http://localhost:9999/actuator/bindings 我设置了management.endpoints.web.base-path=/。所以它是http://localhost:9999/bindings,但不是http://localhost:9999/actuator/bindings 【参考方案1】:

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

【讨论】:

如何为开发目的禁用 Spring Cloud Stream 绑定?

】如何为开发目的禁用SpringCloudStream绑定?【英文标题】:Howtodisablespringcloudstreambindingfordeveloppurposes?【发布时间】:2018-01-2410:48:41【问题描述】:我需要禁用事件的发布和订阅以进行开发,但我找不到一些配置属性/其他解决方... 查看详情

使用 Spring Cloud Stream 将 RabbitMQ 消费者绑定到现有队列

】使用SpringCloudStream将RabbitMQ消费者绑定到现有队列【英文标题】:BindRabbitMQconsumerusingSpringCloudStreamtoanexistingqueue【发布时间】:2017-04-2813:52:16【问题描述】:我使用RabbitMQweb-UI创建了一个主题交换TX并绑定到交换两个队列TX.Q1和TX.... 查看详情

具有多个路由键的spring引导流绑定队列(代码片段)

我需要使用多个路由键绑定单个队列。我在application.properties中有配置:spring.cloud.stream.bindings.some-channel1.destination=exchspring.cloud.stream.bindings.some-channel1.group=a-queuespring.cloud.stream.rabbit.bindings.som 查看详情

Spring Cloud Stream 动态通道

】SpringCloudStream动态通道【英文标题】:SpringCloudStreamdynamicchannels【发布时间】:2017-05-3105:41:50【问题描述】:我正在使用SpringCloudStream并希望以编程方式创建和绑定频道。我的用例是在应用程序启动期间,我收到要订阅的Kafka主... 查看详情

如何在spring cloud stream和kafka中从同一主题发送和接收

】如何在springcloudstream和kafka中从同一主题发送和接收【英文标题】:howtosendandreceivefromthesametopicwithinspringcloudstreamandkafka【发布时间】:2016-11-2410:49:07【问题描述】:我有一个带有kafka绑定的spring-cloud-stream应用程序。我想从同一... 查看详情

使用 GCP pubsub 的 Spring Cloud Stream 消费者的并发设置

】使用GCPpubsub的SpringCloudStream消费者的并发设置【英文标题】:ConcurrencysettingsforSpringCloudStreamconsumerwithGCPpubsub【发布时间】:2020-06-0123:44:05【问题描述】:我的应用程序正在使用绑定到GCPpubsub的SpringCloudStream接收消息。我正在试... 查看详情

spring-cloud-stream 请求-回复消息模式

】spring-cloud-stream请求-回复消息模式【英文标题】:spring-cloud-streamrequest-replymessagingpattern【发布时间】:2016-06-2010:24:22【问题描述】:是否有一种应与spring-cloud-stream一起使用的请求-回复模式?我可以在spring-cloud-stream上找到的所... 查看详情

spring cloud-stream 和 spring cloud-bus 有啥区别?

】springcloud-stream和springcloud-bus有啥区别?【英文标题】:Whatisthedifferencebetweenspringcloud-streamandspringcloud-bus?springcloud-stream和springcloud-bus有什么区别?【发布时间】:2018-10-2212:22:12【问题描述】:它们之间有什么区别?springcloud-stre... 查看详情

Spring Cloud 2020.0.0 中的 Spring Cloud Bus/Stream 问题

】SpringCloud2020.0.0中的SpringCloudBus/Stream问题【英文标题】:SpringCloudBus/StreamIssuesinSpringCloud2020.0.0【发布时间】:2021-04-2019:36:03【问题描述】:我们有一个SpringBoot微服务,除了HTTP端点使用SpringCloudBus来获取刷新事件(来自rabbit),... 查看详情

spring-cloud-stream整合rabbitmq

1,依赖与配置1pom.xml<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-stream-rabbit</artifactId></dependency>2,配置文件相关内容,这里使用系统默认的两 查看详情

Spring Cloud Stream 验证

】SpringCloudStream验证【英文标题】:SpringCloudStreamvalidation【发布时间】:2018-05-1812:00:09【问题描述】:如何使用基于标准Spring注解的验证在消息侦听器中使用SpringCloudStream框架执行验证?尝试了不同的情况,使用@Valid@Payloadfor传入... 查看详情

spring-cloud-stream kafka 消费者并发

】spring-cloud-streamkafka消费者并发【英文标题】:spring-cloud-streamkafkaconsumerconcurrency【发布时间】:2016-06-2115:28:03【问题描述】:使用spring-cloud-stream的kafkabinder,如何配置并发消息消费者(在单个消费者jvm中)?如果我理解正确,... 查看详情

Spring 集成和 Spring Cloud Stream

】Spring集成和SpringCloudStream【英文标题】:SpringIntegrationandSpringCloudStream【发布时间】:2019-03-0820:14:57【问题描述】:我正在编写一个应用程序轮询目录(Sprint集成DSL流程)一旦文件可用,它将放入rabbitmq队列微服务监听流RabbitMQ... 查看详情

Spring Cloud Stream - 聚合

】SpringCloudStream-聚合【英文标题】:SpringCloudStream-Aggregates【发布时间】:2017-06-2015:01:15【问题描述】:我正在尝试实施建议的SCS聚合,但我不确定它们的真正目的,因为我得到的结果让我感到惊讶。首先,这是代码...源,要调... 查看详情

使用 spring-boot:1.5.1 和 spring-cloud-stream 时无法启动 bean 'inputBindingLifecycle'

】使用spring-boot:1.5.1和spring-cloud-stream时无法启动bean\\\'inputBindingLifecycle\\\'【英文标题】:Failedtostartbean\'inputBindingLifecycle\'whenusingspring-boot:1.5.1andspring-cloud-stream使用spring-boot:1.5.1和spring-cloud-stream时无法启动b 查看详情

Spring Cloud Stream RabbitMQ

】SpringCloudStreamRabbitMQ【英文标题】:【发布时间】:2018-01-2405:05:42【问题描述】:我试图理解为什么我想将Spring云流与RabbitMQ一起使用。我看过RabbitMQSpring教程4(https://www.rabbitmq.com/tutorials/tutorial-four-spring-amqp.html),这基本上是我... 查看详情

Dispatcher 没有频道订阅者 - spring-cloud-stream-kafka

】Dispatcher没有频道订阅者-spring-cloud-stream-kafka【英文标题】:Dispatcherhasnosubscribersforchannel-spring-cloud-stream-kafka【发布时间】:2018-09-1706:32:52【问题描述】:升级到SpringBoot2、Reactor3.5、kafka-binder2.0.0RELEASE和kafka-client1.0.1后,其中一... 查看详情

spring-cloud-stream-kafka 在应用程序启动后仅使用最新消息

】spring-cloud-stream-kafka在应用程序启动后仅使用最新消息【英文标题】:spring-cloud-stream-kafkaConsumeonlylatestmessagesafterapplicationstartup【发布时间】:2017-12-0108:24:03【问题描述】:在我们的项目中,我们使用spring-cloud-stream-binder-kafka1.1.2... 查看详情