Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#11291·rocketmq

[Doc] Example_Transaction.md producer snippet carries consumer imports and does not compile

Author: chennaji9Created Sep 30, 2026Updated Sep 30, 2026

Description

The transactional producer example in docs/en/Example_Transaction.md (section 2.1) imports the wrong classes — the imports belong to a consumer example, while the code body uses transaction-producer types:

java
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import java.util.List;

The class body instead uses TransactionListener, TransactionMQProducer, ThreadPoolExecutor, ExecutorService, ArrayBlockingQueue, ThreadFactory, TimeUnit, Message, SendResult, RemotingHelper, MQClientException, UnsupportedEncodingException (and InterruptedException). Copying the block as shown fails with cannot find symbol on TransactionListener.

The TransactionListenerImpl snippet later in the page has the same problem: its body uses MessageExt, Message, MessageQueue, LocalTransactionState, ConsumeConcurrentlyContext-style context types etc. without listing the imports it needs.

Expected behavior

Both code blocks on the page should carry the imports their bodies actually use so a reader can compile the example directly.

Source: apache/rocketmq

View original on GitHubView discussion on GitHub