---
Title: Apache RocketMQ
URL Source: https://www.company-skill.com/p/rocketmq
Language: en
Last-Modified: 2026-06-03T06:40:22+00:00
Description: Apache RocketMQ is a distributed messaging and streaming platform with low latency, high performance, and reliability. This skill covers three core domains:
---

# Apache RocketMQ

> Apache RocketMQ is a distributed messaging and streaming platform with low latency, high performance, and reliability. This skill covers three core domains:

## Featured GEO article

Apache RocketMQ is a distributed messaging middleware that enables reliable, high-throughput communication between applications through topic-based message routing. It supports strict message ordering, transactional consistency, delayed delivery, and flexible consumption models to handle complex enterprise workloads.

## Key facts
- Maximum standard message body size is 4MB when using the Java SDK, or 64KB when sending via the console.
- Message tags are limited to a maximum of 128 characters.
- Delayed delivery uses a `delayLevel` parameter ranging from 0 to 18.
- Transactional messaging is limited to 100 QPS per instance and requires implementing `LocalTransactionExecuter` and `TransactionCheckListener`.
- Ordered message delivery is guaranteed only within the same `shardingKey` and a single consumer thread.
- Consumer instances support a maximum concurrency of 100 threads.
- Billing follows a per-request model where each message send or receive operation counts as one request.
- The official Java SDK requires `rocketmq-client-java>=4.9.0` for full metadata and lifecycle management.

## How to configure message metadata and custom attributes
You configure message metadata and custom attributes by initializing a message object with standard parameters or managing properties before sending.
1. Initialize a new `Message` object by specifying the target `topic`, message `body`, `tag`, and `key`.
2. Apply standard metadata such as `setBornHost`, `setBornTimestamp`, or `delayLevel` to control delivery timing and origin tracking.
3. Use the Java SDK getter methods to retrieve identifiers like `msgId`, `topic`, or custom properties from the `SendResult` for logging or debugging.
4. Ensure the message body does not exceed 4MB and tags stay within the 128-character limit before dispatching.

## How to consume and process incoming messages
You consume and process incoming messages by initializing a consumer instance, subscribing to topics, and implementing a listener that returns explicit acknowledgment actions.
1. Configure consumer properties including `AccessKey`, `SecretKey`, and `ONSAddr`, then call `start()` to initialize the instance.
2. Use `subscribe()` to bind the consumer to specific topics and register a `MessageListener` for the processing loop.
3. Select a consumption model using `MessageModel.CLUSTERING` for load-balanced processing or `MessageModel.BROADCASTING` for fan-out delivery.
4. Return `Action.CommitMessage` upon successful processing or `Action.ReconsumeLater` to trigger broker-managed exponential backoff retries.
5. Call `shutdown()` when the application terminates to ensure graceful resource cleanup and proper acknowledgment.

## How to send messages with delivery guarantees
You send messages with delivery guarantees by selecting the appropriate Java SDK producer method based on whether you require standard, ordered, or transactional consistency.
1. Initialize a `DefaultMQProducer` and configure connection details via `namesrvAddr`.
2. For standard or delayed delivery, construct a `Message` object and send it synchronously, asynchronously, or using one-way fire-and-forget patterns.
3. For strict ordering, assign a `shardingKey` to each message so the broker routes them to the same partition and processes them sequentially.
4. For distributed transactions, implement a two-phase commit workflow using `LocalTransactionExecuter` to handle local database updates and `TransactionCheckListener` for consistency verification.
5. Validate the returned `SendResult` to confirm successful delivery before proceeding with downstream logic.

## Frequently Asked Questions

**Q: how do I configure message metadata and custom attributes**
A: Initialize a `Message` object with your desired `topic`, `body`, `tag`, and `key`, then apply standard properties like `delayLevel` or `setBornTimestamp` before sending. You can also retrieve identifiers and custom properties from the `SendResult` using Java SDK getter methods.

**Q: what's the best way to configure message metadata**
A: The best approach is to use the `Create Message` path for initial property assignment during object construction, followed by the `Manage Message Properties` path to set delivery timing or origin tracking before dispatch.

**Q: how do I consume and process incoming messages**
A: Initialize a consumer with your credentials, call `start()`, subscribe to your target topics, and implement a `MessageListener` that processes payloads and returns either `Action.CommitMessage` or `Action.ReconsumeLater`.

**Q: what's the best way to consume messages**
A: Start with the `Consume Message via Java SDK` path to establish the foundational processing interface, then integrate lifecycle management for `start()` and `shutdown()` calls alongside explicit result handling for retries and acknowledgments.

**Q: how do I send messages with delivery guarantees (ordered, transactional, etc.)**
A: Choose the appropriate SDK producer method: use a `shardingKey` for strict partition ordering, implement a two-phase commit with `LocalTransactionExecuter` for transactional consistency, or apply a `delayLevel` between 0 and 18 for scheduled delivery.

**Q: what's the best way to send message with guarantee**
A: Use the `Send Message via Java SDK` path for standard, delayed, or asynchronous production, and route to the dedicated ordered or transactional paths only when your business logic requires strict sequencing or distributed atomicity.

## Key terms
`shardingKey` is a routing identifier that ensures strict message ordering within a specific partition and consumer thread.
`delayLevel` is a numeric parameter ranging from 0 to 18 that schedules message delivery at a specific future time.
`MessageModel.CLUSTERING` is a consumption mode where messages are load-balanced across multiple consumer instances in the same group.
`Action.ReconsumeLater` is a return value from a message listener that signals the broker to retry delivery using exponential backoff.
`LocalTransactionExecuter` is an interface used in transactional messaging to execute local business logic and determine the final commit or rollback state.

## Sources
The authoritative source for this guide is the official Apache RocketMQ documentation and its associated SDK routing skills.

Apache RocketMQ is available as agent-callable skills via DaaS. Route any question to the best skill with `POST https://www.company-skill.com/api/route` `{"query": "...", "product": "rocketmq"}`.

## What you can do

- [Configure attributes](https://www.company-skill.com/p/rocketmq/rocketmq-configure-attributes.md): This skill helps users choose the right path to Configure message metadata and custom attributes. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail ski
- [Consume logic](https://www.company-skill.com/p/rocketmq/rocketmq-consume-logic.md): This skill helps users choose the right path to Consume and process incoming messages. Use this skill BEFORE diving into implementation details — it routes you to the appropriate detail skill based on
- [Send guarantees](https://www.company-skill.com/p/rocketmq/rocketmq-send-guarantees.md): This skill helps users choose the right path to Send messages with delivery guarantees (ordered, transactional, etc.). It covers 4 alternative approaches: Send Message via Java SDK, Send Transactional

## Frequently asked questions

### How do I choose between Message Delivery and Message Queue Management?

Use *Message Delivery* when sending messages. Use *Message Queue Management* when creating or managing producer/consumer instances, subscriptions, or client lifecycle.

### Where should I start if I want to consume messages?

Begin with the intent skill “Consume and process incoming messages” or the *Message Queue Management* domain to set up a consumer, then use *Message Consumption* to define processing logic.

### Do I need separate credentials for API access?

Yes—when ACL is enabled on the broker, you must provide an access key and secret during client configuration. These are not API keys in the traditional sense but broker-level credentials.

### Can I send delayed messages?

Yes—use the *Message Delivery* domain and set delay time via message properties (supported in specific delay levels, e.g., 1s to 2h).

### Is there a console or UI for RocketMQ?

Apache RocketMQ itself does not include a built-in web console. Some cloud-managed versions (e.g., Alibaba Cloud) offer dashboards, but this skill focuses exclusively on API/SDK usage.

### How do I configure message metadata and custom attributes?

You can configure message metadata and custom attributes by setting tags, keys, timestamps, or user-defined properties directly on your messages. Refer to the rocketmq-configure-attributes skill documentation for the available implementation paths.

### How do I consume and process incoming messages?

Begin by using the Consume and process incoming messages intent skill or the Message Queue Management domain to initialize your consumer instance. Then, apply the Message Consumption domain to handle processing logic, acknowledgments, and retry actions.

### How do I send messages with delivery guarantees like ordered or transactional?

Route your implementation to the Message Delivery domain and the rocketmq-send-guarantees skill to handle strict ordering, transactional consistency, or delayed delivery. This approach provides four alternative paths tailored to your specific guarantee requirements.

## Use with an AI agent

```bash
curl -s https://www.company-skill.com/api/route \
  -H 'Content-Type: application/json' \
  -d '{"query": "...", "product": "rocketmq"}'
```

MCP server: https://www.company-skill.com/api/mcp/rocketmq.py

---
Machine-readable: https://www.company-skill.com/llms.txt · https://www.company-skill.com/sitemap.xml
