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:
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.
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:The class body instead uses
TransactionListener,TransactionMQProducer,ThreadPoolExecutor,ExecutorService,ArrayBlockingQueue,ThreadFactory,TimeUnit,Message,SendResult,RemotingHelper,MQClientException,UnsupportedEncodingException(andInterruptedException). Copying the block as shown fails withcannot find symbolonTransactionListener.The
TransactionListenerImplsnippet later in the page has the same problem: its body usesMessageExt,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.