Remoting Connector (DataStream API)

July 22, 2026 ยท View on GitHub

The remoting connector (flink-connector-rocketmq) talks to RocketMQ over the classic remoting protocol using rocketmq-client. It provides a FLIP-27 RocketMQSource and a SinkV2 RocketMQSink with two-phase-commit support.

Source

RocketMQSource<String> source = RocketMQSource.<String>builder()
        .setEndpoints("127.0.0.1:9876")
        .setGroupId("GID-flink")
        .setTopics("topic-a", "topic-b")
        .setMinOffsets(OffsetsSelector.latest())      // starting offsets
        .setBodyOnlyDeserializer(new SimpleStringSchema())
        .build();

Builder methods:

MethodDescription
setEndpoints(String)Name server address, required
setGroupId(String)Consumer group, required
setTopics(String... / List<String>)Topics to consume, required
setMinOffsets(OffsetsSelector)Starting offsets: earliest() / latest() / committedOffsets() / timestamp(ts)
setBounded(OffsetsSelector) / setUnbounded(OffsetsSelector)Stopping offsets and boundedness
setDeserializer(...) / setBodyOnlyDeserializer(...)Record deserialization
setConfig(Configuration) / setProperties(Properties)Pass any option from the tables below

Notes:

  • The source consumes with DefaultLitePullConsumer.assign(); with checkpointing enabled offsets are committed on checkpoint (rocketmq.source.offset.commit.checkpoint, default true).
  • On Aliyun commercial 5.x instances the admin route lookup is not available; the source falls back to consumer-side offset lookup automatically. Topics and groups must be created in the console (mqadmin is not supported there).

Sink

RocketMQSink<String> sink = RocketMQSink.<String>builder()
        .setEndpoints("127.0.0.1:9876")
        .setGroupId("PID-flink")
        .setDeliveryGuarantee(DeliveryGuarantee.EXACTLY_ONCE)   // or AT_LEAST_ONCE / NONE
        .setSerializer(mySerializationSchema)                   // builds Message objects (topic/tag/keys per record)
        .build();
  • AT_LEAST_ONCE uses async sends with a pending counter and a flush barrier on checkpoint.
  • EXACTLY_ONCE uses TransactionMQProducer two-phase commit driven by Flink checkpoints; set rocketmq.sink.transaction.timeout larger than the checkpoint interval.

Client options (rocketmq.client.*)

Shared by source and sink.

KeyTypeDefaultDescription
rocketmq.client.endpointsString(none)Name server address, required
rocketmq.client.namespaceString(none)Instance namespace
rocketmq.client.accessKey / rocketmq.client.secretKeyString(none)ACL credentials
rocketmq.client.channelEnumCLOUDAccess channel (LOCAL / CLOUD)
rocketmq.client.tls.enableBooleanfalseTLS transport
rocketmq.client.network.timeout.msLong30000Client API timeout
rocketmq.client.callback.threadsIntegerCPU coresClient callback executor threads
rocketmq.client.partition.discovery.interval.msLong10000Route/partition discovery interval
rocketmq.client.unitMode / rocketmq.client.unitNameBoolean / Stringfalse / (none)Unit mode routing
rocketmq.client.debugBooleanfalseVerbose client logs

Source options (rocketmq.source.*)

KeyTypeDefaultDescription
rocketmq.source.topicString(none)Topic, required
rocketmq.source.groupString(none)Consumer group, required
rocketmq.source.filter.tagString*Tag filter (client-side in assign mode)
rocketmq.source.filter.sqlString(none)SQL92 filter (client-side in assign mode)
rocketmq.source.startup.scan.modeStringlatestearliest / latest / group / timestamp / specific
rocketmq.source.startup.offset.timestampLong(none)Startup timestamp; auto-infers scan.mode=timestamp
rocketmq.source.allocate.strategyStringconsistent-hashQueue-to-subtask allocation strategy
rocketmq.source.pull.threads.numInteger20Pull thread pool size
rocketmq.source.pull.batch.sizeLong32Max messages per pull
rocketmq.source.pull.threshold.queueLong1000Queue-level flow control threshold
rocketmq.source.pull.threshold.allLong10000Total flow control threshold
rocketmq.source.pull.rpc.timeoutLong20000Pull RPC timeout (ms)
rocketmq.source.pull.rpc.exception.delayLong3000Pull retry delay on exception (ms)
rocketmq.source.offset.commit.autoBooleantrueAuto offset commit
rocketmq.source.offset.commit.intervalLong5000Auto commit interval (ms)
rocketmq.source.offset.commit.checkpointBooleantrueCommit offsets on checkpoint
rocketmq.source.trace.enableBooleantrueMessage trace
rocketmq.source.trace.topicString(none)Customized trace topic

Sink options (rocketmq.sink.*)

KeyTypeDefaultDescription
rocketmq.sink.topicString(none)Topic, required for SQL
rocketmq.sink.groupStringPID-flink-producerProducer group
rocketmq.sink.tagString(none)Static message tag
rocketmq.sink.delivery.guaranteeStringAT_LEAST_ONCENONE / AT_LEAST_ONCE / EXACTLY_ONCE
rocketmq.sink.transaction.timeoutLong900 (s)Transaction timeout for EXACTLY_ONCE
rocketmq.sink.send.timeoutLong5000Send timeout (ms)
rocketmq.sink.send.retry.timesInteger3Send retry times
rocketmq.sink.send.pending.maxInteger1000Max in-flight async sends (AT_LEAST_ONCE)
rocketmq.sink.executor.numInteger4Producer executor threads
rocketmq.sink.key.columnsString(none)SQL: columns used as message keys
rocketmq.sink.tag.dynamic.enable / rocketmq.sink.tag.dynamic.columnBoolean / Stringfalse / (none)SQL: derive the tag from a column