kandi background
Explore Kits

spring-cloud-examples | Spring Cloud 学习案例,服务发现、服务治理、链路追踪、服务监控等 | Microservice library

 by   ityouknow Java Version: Current License: No License

 by   ityouknow Java Version: Current License: No License

Download this library from

kandi X-RAY | spring-cloud-examples Summary

spring-cloud-examples is a Java library typically used in Architecture, Microservice, Spring Boot, Spring applications. spring-cloud-examples has no bugs, it has no vulnerabilities and it has medium support. However spring-cloud-examples build file is not available. You can download it from GitHub.
Spring Cloud 中文索引  |   Spring Boot学习示例代码  |   参与贡献. English  |   github地址  |   码云地址. 关注后,回复:java 获取超过 10万 人领取的 Java 知识体系/面试必看资料。.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • spring-cloud-examples has a medium active ecosystem.
  • It has 5687 star(s) with 3027 fork(s). There are 417 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 1 open issues and 35 have been closed. On average issues are closed in 232 days. There are 1 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of spring-cloud-examples is current.
This Library - Support
Best in #Microservice
Average in #Microservice
This Library - Support
Best in #Microservice
Average in #Microservice

quality kandi Quality

  • spring-cloud-examples has 0 bugs and 92 code smells.
This Library - Quality
Best in #Microservice
Average in #Microservice
This Library - Quality
Best in #Microservice
Average in #Microservice

securitySecurity

  • spring-cloud-examples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • spring-cloud-examples code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
This Library - Security
Best in #Microservice
Average in #Microservice
This Library - Security
Best in #Microservice
Average in #Microservice

license License

  • spring-cloud-examples does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
This Library - License
Best in #Microservice
Average in #Microservice
This Library - License
Best in #Microservice
Average in #Microservice

buildReuse

  • spring-cloud-examples releases are not available. You will need to build from source code and install.
  • spring-cloud-examples has no build file. You will be need to create the build yourself to build the component from source.
  • spring-cloud-examples saves you 1987 person hours of effort in developing the same functionality from scratch.
  • It has 4370 lines of code, 143 functions and 186 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
This Library - Reuse
Best in #Microservice
Average in #Microservice
This Library - Reuse
Best in #Microservice
Average in #Microservice
Top functions reviewed by kandi - BETA

kandi has reviewed spring-cloud-examples and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-examples implemented functionality, and help decide if they suit your requirements.

  • run Zuul
  • Returns the fallback response .
  • Custom route locator .
  • Returns the route for the CloudCloud producer
  • List of services
  • bean key resolver .
  • The key resolver .
  • Throw an exception message
  • Display a message send
  • return true if there is no filter

spring-cloud-examples Key Features

spring-cloud-eureka:eureka server单机、双机、集群示例

eureka-producer-consumer:利用eureka实现服务提供与调用示例

spring-cloud-hystrix:Hystrix熔断的使用示例

hystrix-dashboard-turbine:熔断监控Hystrix Dashboard和Turbine的示例

spring-cloud-config-git:配置中心git版本示例

spring-cloud-config-svn-refresh:配置中心svn版本示例,客户端refresh版本示例

spring-cloud-config-eureka:配置中心服务化和高可用代码示例

spring-cloud-config-eureka-bus:配置中心和消息总线示例(配置中心终结版)

gateway-service-zuul:Spring Cloud Zuul使用初级篇 网关 均衡负载

spring-cloud-zuul:Spring Cloud Zuul使用高级篇 Filter 鉴权 熔断 重试

spring-cloud-sleuth-zipkin: 利用Sleuth、Zipkin对Spring Cloud应用进行服务追踪分析

spring-boot-admin-eureka: 使用Spring Boot Admin 对Spring Cloud集群进行监控示例

spring-cloud-consul: Spring Cloud 使用 Consul 作为服务中心示例

spring-cloud-gateway: Spring Cloud 使用 gateway 的相关示例

springcloud(一):大话Spring Cloud

springcloud(二):注册中心Eureka

springcloud(三):服务提供与调用

springcloud(四):熔断器Hystrix

springcloud(五):熔断监控Hystrix Dashboard和Turbine

springcloud(六):配置中心git示例

springcloud(七):配置中心svn示例和refresh

springcloud(八):配置中心服务化和高可用

springcloud(九):配置中心和消息总线(配置中心终结版)

springcloud(十):服务网关zuul

springcloud(十一):服务网关Zuul高级篇

springcloud(十二):使用Spring Cloud Sleuth和Zipkin进行分布式链路跟踪

springcloud(十三):Spring Cloud Consul 使用详解

Spring Cloud (十四):Spring Cloud 开源软件都有哪些?

springcloud(十五):服务网关 Spring Cloud GateWay 初级篇

springcloud(十六):服务网关 Spring Cloud GateWay 服务化和过滤器

springcloud(十七):服务网关 Spring Cloud GateWay 熔断、限流、重试

Spring Cloud在国内中小型公司能用起来吗?

中小型互联网公司微服务实践-经验和教训

从架构演进的角度聊聊Spring Cloud都做了些什么?

阿里Dubbo疯狂更新,关Spring Cloud什么事?

Spring Cloud Stream: @StreamListener processing messages twice

copy iconCopydownload iconDownload
spring.cloud.stream.bindings.input1.destination=dest_1
spring.cloud.stream.bindings.output1.destination=dest_1
id=788e8bbf-4ae4-86cc-0859-d4f153cb5807
id=2f22ce16-bb5a-350c-8b3d-e6c898760888
-----------------------
spring.cloud.stream.bindings.input1.destination=dest_1
spring.cloud.stream.bindings.output1.destination=dest_1
id=788e8bbf-4ae4-86cc-0859-d4f153cb5807
id=2f22ce16-bb5a-350c-8b3d-e6c898760888
-----------------------
@Bean
public static BeanFactoryPostProcessor bfpp() {
    return bf -> bf.getBean(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME,
        PublisherAnnotationBeanPostProcessor.class).setProxyTargetClass(true);
}

Community Discussions

Trending Discussions on spring-cloud-examples
  • Spring Cloud Stream: @StreamListener processing messages twice
Trending Discussions on spring-cloud-examples

QUESTION

Spring Cloud Stream: @StreamListener processing messages twice

Asked 2019-Aug-22 at 03:45

I'm using Spring Cloud Stream (Edgware.SR5) with Spring Boot (1.5.10.RELEASE). My @StreamListener is processing twice every message it receives.

The idea of the example is to publish a message in a queue and the process it.

Service:

@EnableBinding(ExampleBindings.class)
@Service
public class ExampleService {

    @Publisher(channel = ExampleBindings.OUTPUT)
    public String queue(String message){
        return message;
    }

    @StreamListener(ExampleBindings.INPUT)
    public void dequeue(String message){
        System.out.println("New message: " + message);
    }
}

Bindings:

public interface ExampleBindings {

    String INPUT = "input1";
    String OUTPUT = "output1";

    @Input(ExampleBindings.INPUT)
    SubscribableChannel input();

    @Output(ExampleBindings.OUTPUT)
    MessageChannel output();
}

application.properties:

spring.cloud.stream.default.group=group1
spring.cloud.stream.default.binder=binder1

spring.cloud.stream.bindings.input1.destination=dest_1
spring.cloud.stream.bindings.output1.destination=dest_1

spring.cloud.stream.binders.binder1.type=rabbit
spring.cloud.stream.binders.binder1.environment.spring.rabbitmq.host=localhost

Configuration (for injecting proxied service in the test):

@Configuration
public class ExampleConfig {

    @Bean
    public PublisherAnnotationBeanPostProcessor publisherAnnotationBeanPostProcessor(){
         PublisherAnnotationBeanPostProcessor publisherAnnotationBeanPostProcessor =
            new PublisherAnnotationBeanPostProcessor();
        publisherAnnotationBeanPostProcessor.setProxyTargetClass(true);
        return publisherAnnotationBeanPostProcessor;
    }
}

Test:

@RunWith(SpringRunner.class)
@SpringBootTest
public class ExampleServiceTest {

    @Autowired
    private ExampleService exampleService;

    @Test
    public void testQueue() throws InterruptedException {
        exampleService.queue("Hello!");
        Thread.sleep(1000);//Wait for message processing
        System.out.println("Ready!");
    }
}

I'm having the following output:

17:19:10.230 [dest1.group1-2] DEBUG o.s.c.s.b.StreamListenerMessageHandler - org.springframework.cloud.stream.binding.StreamListenerMessageHandler@575c3e9b received message: GenericMessage [payload=Hello!, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=dest1, amqp_receivedExchange=dest1, amqp_deliveryTag=1, amqp_consumerQueue=dest1.group1, amqp_redelivered=false, id=2f22ce16-bb5a-350c-8b3d-e6c898760888, amqp_consumerTag=amq.ctag-sxu6zQHJTGrsazfwbmol9Q, contentType=text/plain, timestamp=1547583550230}]
New message: Hello!
17:19:10.231 [dest1.group1-1] DEBUG o.s.c.s.b.StreamListenerMessageHandler - handler 'org.springframework.cloud.stream.binding.StreamListenerMessageHandler@575c3e9b' produced no reply for request Message: GenericMessage [payload=Hello!, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=dest1, amqp_receivedExchange=dest1, amqp_deliveryTag=1, amqp_consumerQueue=dest1.group1, amqp_redelivered=false, id=788e8bbf-4ae4-86cc-0859-d4f153cb5807, amqp_consumerTag=amq.ctag-fV0aaDzYUZfq08JsODq6pA, contentType=text/plain, timestamp=1547583550230}]
17:19:10.231 [dest1.group1-1] DEBUG o.s.i.channel.DirectChannel - postSend (sent=true) on channel 'input1', message: GenericMessage [payload=Hello!, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=dest1, amqp_receivedExchange=dest1, amqp_deliveryTag=1, amqp_consumerQueue=dest1.group1, amqp_redelivered=false, id=788e8bbf-4ae4-86cc-0859-d4f153cb5807, amqp_consumerTag=amq.ctag-fV0aaDzYUZfq08JsODq6pA, contentType=text/plain, timestamp=1547583550230}]
New message: Hello!
17:19:10.232 [dest1.group1-2] DEBUG o.s.c.s.b.StreamListenerMessageHandler - handler 'org.springframework.cloud.stream.binding.StreamListenerMessageHandler@575c3e9b' produced no reply for request Message: GenericMessage [payload=Hello!, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=dest1, amqp_receivedExchange=dest1, amqp_deliveryTag=1, amqp_consumerQueue=dest1.group1, amqp_redelivered=false, id=2f22ce16-bb5a-350c-8b3d-e6c898760888, amqp_consumerTag=amq.ctag-sxu6zQHJTGrsazfwbmol9Q, contentType=text/plain, timestamp=1547583550230}]
17:19:10.232 [dest1.group1-2] DEBUG o.s.i.channel.DirectChannel - postSend (sent=true) on channel 'input1', message: GenericMessage [payload=Hello!, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=dest1, amqp_receivedExchange=dest1, amqp_deliveryTag=1, amqp_consumerQueue=dest1.group1, amqp_redelivered=false, id=2f22ce16-bb5a-350c-8b3d-e6c898760888, amqp_consumerTag=amq.ctag-sxu6zQHJTGrsazfwbmol9Q, contentType=text/plain, timestamp=1547583550230}]
Ready!

I can't figure out what is the problem with my configuration or if it is some bug, any advice?

Thanks!

EDITED:

I uploaded a (non) working example here

You can create a RabbitMQ instance using:

docker run -p 5672:5672 -p 15672:15672 rabbitmq:3-management

ANSWER

Answered 2019-Jan-15 at 22:39

From the config, I think, you are trying to publish the same message again to the same destination dest_1.

spring.cloud.stream.bindings.input1.destination=dest_1
spring.cloud.stream.bindings.output1.destination=dest_1

And from the log it is clear, the 2nd message has a different ID

id=788e8bbf-4ae4-86cc-0859-d4f153cb5807
id=2f22ce16-bb5a-350c-8b3d-e6c898760888

Source https://stackoverflow.com/questions/54207305

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install spring-cloud-examples

You can download it from GitHub.
You can use spring-cloud-examples like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-cloud-examples component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Microservice Libraries
Compare Microservice Libraries with Highest Support
Compare Microservice Libraries with Highest Security
Compare Microservice Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.