Git Product home page Git Product logo

camel-rocketmq's Introduction

Camel RocketMQ component

This project has been donated to Apache Camel.

The camel-rocketmq has officially been released from the Apache Camel!

Maven: https://search.maven.org/artifact/org.apache.camel/camel-rocketmq

Please use the following dependency:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-rocketmq</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Source codes: https://github.com/apache/camel/tree/main/components/camel-rocketmq


GitHub Actions Maven Central GitHub camel-rocketmq

EN doc CN doc

Getting Started

Maven:

<dependency>
    <groupId>icu.wwj.camel</groupId>
    <artifactId>camel-rocketmq</artifactId>
    <version>3.2.0</version>
</dependency>

Versions:

Camel version Component version Release
3.2.0 3.2.0-* 3.2.0
2.25.0 2.25.0-* 2.25.0-0.0.1

Elder version's groupId is vip.wuweijie.camel, which can be found in:

https://repo.maven.apache.org/maven2/vip/wuweijie/camel/camel-rocketmq/

Basic Usage

from("rocketmq:from_topic?namesrvAddr=localhost:9876&consumerGroup=consumer")
    .to("rocketmq:to_topic?namesrvAddr=localhost:9876&producerGroup=producer");

InOut Pattern

InOut Pattern based on Message Key. When the producer sending the message, a messageKey will be generated and append to the message's key.

After the message sent, a consumer will listen to the topic configured by the parameter ReplyToTopic.

When a message from ReplyToTpic contains the key, it means that the reply received and continue routing.

If requestTimeoutMillis elapsed and no reply received, an exception will be thrown.

from("rocketmq:{{inout.rocketmq.topic.from}}?namesrvAddr={{rocketmq.namesrv.addr}}" +
        "&consumerGroup={{inout.rocketmq.consumer.group}}" +
        "&requestTimeoutMillis=10000")

.inOut("rocketmq:{{inout.rocketmq.topic.to}}?namesrvAddr={{rocketmq.namesrv.addr}}" +
        "&producerGroup={{inout.rocketmq.producer.group}}" +
        "&replyToTopic={{inout.rocketmq.reply.to.topic}}" +
        "&requestTimeoutMillis={{inout.request.timeout}}" +
        "&replyToConsumerGroup={{inout.rocketmq.reply.to.consumer}}"
)

.to("log:InOutRoute?showAll=true")

Notice: In InOut pattern, the message won't be routed until reply received.

Component Parameters

InOnly Pattern

Name Type Description Default
topicName common (Required) consumer/producer's topic
namesrvAddr common NameServer (Separate by comma) localhost:9876
accessKey common Rocketmq acl accessKey
secretKey common Rocketmq acl secretKey
consumerGroup consumer Consumer group name
subscribeTags consumer Subscribe tags expression *
producerGroup producer Producer group name
sendTag producer Send message's tag
waitForSendResult producer Block until message sent false

InOut Pattern

Name Type Description Default
replyToTopic producer The topic to listen for reply
replyToConsumerGroup producer Consumer group
requestTimeoutMillis producer Wait for milliseconds before timeout 10000
requestTimeoutCheckerIntervalMillis advance Timeout checker interval (milliseconds) 1000

Exchange Header

Constant Value Description
RocketMQConstants.OVERRIDE_TOPIC_NAME rocketmq.OVERRIDE_TOPIC_NAME Override the message's Topic
RocketMQConstants.OVERRIDE_TAG rocketmq.OVERRIDE_TAG Override the message's Tag
RocketMQConstants.OVERRIDE_MESSAGE_KEY rocketmq.OVERRIDE_MESSAGE_KEY Set the message's Key
from("rocketmq:{{override.rocketmq.topic.from}}?namesrvAddr={{rocketmq.namesrv.addr}}&consumerGroup={{override.rocketmq.consumer.group}}")
        .process(exchange -> {
            exchange.getMessage().setHeader(RocketMQConstants.OVERRIDE_TOPIC_NAME, "OVERRIDE_TO");
            exchange.getMessage().setHeader(RocketMQConstants.OVERRIDE_TAG, "OVERRIDE_TAG");
            exchange.getMessage().setHeader(RocketMQConstants.OVERRIDE_MESSAGE_KEY, "OVERRIDE_MESSAGE_KEY");
        }
)
.to("rocketmq:{{override.rocketmq.topic.to}}"
                + "?namesrvAddr={{rocketmq.namesrv.addr}}"
                + "&producerGroup={{override.rocketmq.producer.group}}"
)
.to("log:RocketRoute?showAll=true")

camel-rocketmq's People

Contributors

kuaile-zc avatar teslacn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

camel-rocketmq's Issues

How to start up

Hello, how can I start up the test after I start up the Namesrv and the Broker of Rockemq?

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.