Creates a group.

Usage notes

When you release a new application or implement a new business logic, you need new groups. You can call this operation to create a group.

Request limit

Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within 1 second reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API rate limits.

Authorization

By default, only Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation. For information about how to grant permissions, Policies and examples.

API

Action

Resource

OnsGroupCreate

mq:QueryInstanceBaseInfo

mq:CreateGroup

acs:mq:*:*:{instanceId}

Request parameters

Parameter Type Required Example Description
Action String Yes OnsGroupCreate

The operation that you want to perform. Set the value to OnsGroupCreate.

GroupId String Yes GID_test_groupId

The ID of the group that you want to create. Specify the group ID based on the following rules:

  • The ID must be 2 to 64 characters in length and can contain only letters, digits, hyphens (-), and underscores (_).
  • If the Message Queue for Apache RocketMQ instance in which you want to create the group uses a namespace, the group ID must be unique in the instance. The group ID cannot be the same as an existing group ID or a topic name in the instance. The group ID can be the same as a group ID or a topic name in another instance that uses a namespace. For example, if Instance A and Instance B use different namespaces, a group ID in Instance A can be the same as a group ID or topic name in Instance B.
  • If the instance does not use a namespace, the group ID must be globally unique across instances and regions. The group ID cannot be the same as an existing group ID or topic name in Message Queue for Apache RocketMQ instances within your Alibaba Cloud account.
Note
  • After the group is created, the group ID cannot be changed.
  • To check whether an instance uses a namespace, log on to the Message Queue for Apache RocketMQ console, go to the Instance Details page, and then view the value of the Namespace field in the Basic Information section.
Remark String No test

The description of the group.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance in which you want to create the group.

GroupType String No tcp

The protocol over which clients in the group communicate with the Message Queue for Apache RocketMQ broker. All clients in a group communicate with the Message Queue for Apache RocketMQ broker over the same protocol. You must create different groups for TCP clients and HTTP clients. Valid values:

  • tcp: Clients in the group publish or receive messages over TCP. This is the default value.
  • http: Clients in the group publish or receive messages over HTTP.

Response parameters

Parameter Type Example Description
RequestId String A07E3902-B92E-44A6-B6C5-6AA111111****

The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.

Examples

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsGroupCreate
&GroupId=GID_test_groupId
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Remark=test
&GroupType=tcp
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<OnsGroupCreateResponse>
<RequestId>A07E3902-B92E-44A6-B6C5-6AA111111****</RequestId>
</OnsGroupCreateResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "A07E3902-B92E-44A6-B6C5-6AA111111****"
}

Error codes

For a list of error codes, visit the API Error Center.

Create a group in the console

You can also create a group in the Message Queue for Apache RocketMQ console. For more information, see Manage groups.