Giter Site home page Giter Site logo

rocketmq-reactive-client-spring's Introduction

RocketMQ-Reactive-Consumer-Spring

This project aims to help developers quickly integrate RocketMQ-Spring with Reactive.

Features

  • Consuming messages from RocketMQ with Reactive
  • Using Spring content ObjectMapper deserialization

Usage

使用和配置方式类似于 Spring Cloud Stream RocketMQ Binder,但解决一个Stream不能处理流中出现异常无法报告消息失败的问题

application.yml

rocketmq:
  name-server: 192.168.1.21:9876
  producer:
    group: group-test-producer
  bindings:
    testFunction1-in-0:
      consumer:
        topic: test-topic
        group: group-test-consumer
        retry:
          maxAttempts: 3
          backoff:
            delay: 10000
            multiplier: 0.4

consumer

    @Bean
    fun contractCreateChannel(): (Message<String>) -> Mono<Void> = { str ->
        Mono.just("${str.payload}").then()
    }


    @Bean
    fun testChannel(): (Message<String>) -> Mono<ConsumerResult> = { str ->
        Mono.just("${str.payload}").doOnNext(::println).thenReturn(ConsumerResult.SUCCESS)
    }

    @Bean
    fun testReplayChannel(): (Message<String>) -> Mono<ReplayData> = { str ->
        Mono.just("${str.payload}").doOnNext(::println).thenReturn(ReplayData())
    }


    @Bean
    fun testConsumer1(): Consumer<Message<String>> = object: TypedConsumer<Message<String>>(Consumer { msg ->
            println("Receive New Create Messages: ${msg.payload}")
        }){}


    @Bean
    fun testFunction1() = object: TypedReplayConsumer<String>(Function { msg ->
            Mono.just("${msg}").thenReturn("replay")
        }) {}

rocketmq-reactive-client-spring's People

Contributors

cooperlyt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.