Skip to content

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

Description

@chennaji9

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions