Distributed Message Service RocketMQ

Producer

2024-07-08 08:55:00

Relationship Between Application Process, Producer Group, and Producer Instance

A producer group must have different instances in the same process.

Creating and Destroying Instances

1. Create a producer instance using CTGFactory [Compulsory Specifications].

2. A producer is a heavyweight instance and consumes system resources upon each creation and destruction. You are advised to create a producer during system startup and disable it upon system quit. It is not allowed to create new instances when messages are being sent. [Compulsory Specifications].

Recommended Client Parameters

1. Producer parameters:

Constant   Field

Description

namesrv

Address   required. Example: 192.168.10.10:9876;192.168.10.11:9876

namesrv

Username   required

namesrv

Password   required

ClusterName

Cluster   name of the broker to which the client subscribes, which is set as required

TenantID

Tenant   ID, which is set as required

Producer   Group Name

Producer   required

VipChannelEnabled

true or false,   defaulting to true. true: the production and consumption ports   are separated. false: the production and consumption share the same   port.

EnalbeCipher

true or false,   defaulting to false. false: fill in a plaintext password for   the client field. true: fill in an md5 password.

2. Consumer parameters:

Constant   Field

Description

Consumption start position

We   recommend that you set this parameter to:

ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET.name()

Consumer Group Name

Required   for a consumer

Max Number of Consumption Threads

Defaults   to 64 for the push mode

Min Number of Consumption Threads

Defaults   to 20 for the push mode

Consumption Overtime

1.   By default, it is not set or set to <=0, which indicates there is no   overtime handling and it is acked by the application processes.

2.   Set to>0, which indicates that once the consumption overtime is exceeded   for ack by the application, the client automatically fails to ack the   message, which will be sent to the retry queue.

namesrv

Address   required. Example: 192.168.10.10:9876;192.168.10.11:9876

namesrv

Username   required

namesrv

Password   required

ClusterName

Cluster   name of the broker to which the client, defaulting to defaultMQBrokerCluster

TenantID

Tenant   ID, defaulting to defaultMQTenantID


EwpWL8lITKiT