This repository has been archived by the owner on Jan 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,62 @@ | ||
# Camel RocketMQ component | ||
|
||
Usage: | ||
## 快速入门 | ||
|
||
### 基本使用 | ||
``` | ||
from("rocketmq:from_topic?namesrvAddr=localhost:9876&consumerGroup=consumer") | ||
.to("rocketmq:to_topic?namesrvAddr=localhost:9876&producerGroup=producer"); | ||
``` | ||
``` | ||
|
||
### InOut 模式 | ||
|
||
InOut 模式的实现借助了 Message Key,Producer 在发送消息的时候,会生成一个 messageKey 追加到消息的 key 部分。 | ||
|
||
Producer 消息发送后,启动一个 Consumer 监听 `ReplyToTopic` 参数配置的 Topic。 | ||
|
||
当 `ReplyToTpic` 中的消息包含发送消息时生成的 Key,则对应消息的 Reply 已收到,继续执行后续路由。 | ||
|
||
如果超过 `requestTimeout` 毫秒后仍然没有收到 Reply,则抛出异常。 | ||
|
||
``` | ||
from("rocketmq:{{inout.rocketmq.topic.from}}?namesrvAddr={{rocketmq.namesrv.addr}}" + | ||
"&consumerGroup={{inout.rocketmq.consumer.group}}" + | ||
"&requestTimeout=10000") | ||
.inOut("rocketmq:{{inout.rocketmq.topic.to}}?namesrvAddr={{rocketmq.namesrv.addr}}" + | ||
"&producerGroup={{inout.rocketmq.producer.group}}" + | ||
"&replyToTopic={{inout.rocketmq.reply.to.topic}}" + | ||
"&requestTimeout={{inout.request.timeout}}" + | ||
"&replyToConsumerGroup={{inout.rocketmq.reply.to.consumer}}" | ||
) | ||
.to("log:InOutRoute?showAll=true") | ||
``` | ||
|
||
|
||
|
||
注意:**在 InOut 模式下,只有收到 Reply 才会继续路由** | ||
|
||
## 组件参数 | ||
|
||
### InOnly 模式 | ||
|
||
| 参数 | 类型 | 含义 | 默认值 | | ||
|---|---|---|---| | ||
| topicName | common | (必须)消费或生产消息的 topic 名称 | | | ||
| namesrvAddr | common | NameServer 地址,英文逗号分隔 | localhost:9876 | | ||
| consumerGroup | consumer | 消费者组名称 | | | ||
| subscribeTags | consumer | 订阅消息 Tag 表达式 | * | | ||
| producerGroup | producer | 生产者组名称 | | | ||
| sendTag | producer | 发送消息 Tag | | | ||
| waitForSendResult | producer | 是否阻塞发送消息 | false | | ||
|
||
|
||
### InOut 模式 | ||
|
||
| 参数 | 类型 | 含义 | 默认值 | | ||
|---|---|---|---| | ||
| replyToTopic | producer | 监听回复的 Topic || | ||
| replyToConsumerGroup | producer | 监听回复的消费者组 || | ||
| requestTimeout | producer | 等待回复时间 | 10000 | | ||
| requestTimeoutCheckerInterval | advance | 回复超时检查间隔 | 1000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters