< Docs
  • Java


MilvusClient interface. This method creates an empty resource group with a name.

R<RpcStatus> createResourceGroup(CreateResourceGroupParam requestParam);


Use the CreateResourceGroupParam.Builder to construct a CreateResourceGroupParam object.

import io.milvus.param.CreateResourceGroupParam;
CreateResourceGroupParam.Builder builder = CreateResourceGroupParam.newBuilder();

Methods of CreateResourceGroupParam.Builder:

Method Description Parameters
withGroupName(String groupName) Sets the group name. groupName cannot be empty or null. groupName: The name of the group to be created.
build() Construct a CreateResourceGroupParam object. N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R<RpcStatus> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and error message of the exception.

  • If the API succeeds, it returns R.Status.Success.


import io.milvus.param.CreateResourceGroupParam;

R<RpcStatus> response = client.createResourceGroup(CreateResourceGroupParam.newBuilder()

if (response.getStatus() != R.Status.Success.getCode()) {
    throw new RuntimeException(response.getMessage());