Global domain registration in java sdk

I am using temporal 27 ,when i try to register a global domain, its failing unable to register domain

Version temporal 27

Request sent :

RegisterNamespaceRequest request = RegisterNamespaceRequest.newBuilder().setName(ns)
.setEmitMetric(true)
.setHistoryArchivalState(ArchivalState.ARCHIVAL_STATE_ENABLED)
.setIsGlobalNamespace(true)
.setOwnerEmail(“me@myself.me”)
.setWorkflowExecutionRetentionPeriodDays(5).build();
int retryCount = 0;

				// in while loop  i attempt registration with this call ->service.blockingStub().registerNamespace(request);

Response :
io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Cannot register global namespace when not enabled
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:244)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:225)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:142)
at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.registerNamespace(WorkflowServiceGrpc.java:2554)…

If i set the isGlobalDomain to false i am able to register succesfully.

How should i enable global domain?

1 Like

Hey @madhu,
We have renamed the domain concept as namespace in Temporal. So I’m going to assume you meant GlobalNamespace in rest of the response. Based on the error you are seeing looks like GlobalNamespace feature is not turned on for the cluster. You need to configure clusterMetadata section of the config to enable cross datacenter with namespace replication. Here is an example:

ClusterMetadata for Cluster A

clusterMetadata:
  enableGlobalNamespace: true
  replicationConsumer:
    type: kafka
  failoverVersionIncrement: 10
  masterClusterName: "ClusterA"
  currentClusterName: "ClusterA"
  clusterInformation:
    ClusterA:
      enabled: true
      initialFailoverVersion: 1
      rpcName: "frontend"
      rpcAddress: "localhost:7933"
    ClusterB:
      enabled: true
      initialFailoverVersion: 2
      rpcName: "frontend"
      rpcAddress: "localhost:8933"

Configure Kafka for replication on Cluster A:

kafka:
  clusters:
    test:
      brokers:
        - 127.0.0.1:9092
  topics:
    ClusterA:
      cluster: test
    ClusterA-dlq:
      cluster: test
    ClusterB:
      cluster: test
    ClusterB-dlq:
      cluster: test
  temporal-cluster-topics:
    ClusterA:
      topic: ClusterA
      dlq-topic: ClusterA-dlq
    ClusterB:
      topic: ClusterB
      dlq-topic: ClusterB-dlq

And finally make sure publicClient section is also setup correctly in case of call forwarding from one cluster to another:

publicClient:
  hostPort: "localhost:7933"

Here is how the config should look like of ClusterB:

clusterMetadata:
  enableGlobalNamespace: true
  replicationConsumer:
    type: kafka
  failoverVersionIncrement: 10
  masterClusterName: "ClusterA"
  currentClusterName: "ClusterB"
  clusterInformation:
    ClusterA:
      enabled: true
      initialFailoverVersion: 1
      rpcName: "frontend"
      rpcAddress: "localhost:7933"
    ClusterB:
      enabled: true
      initialFailoverVersion: 2
      rpcName: "frontend"
      rpcAddress: "localhost:8933"

kafka:
  clusters:
    test:
      brokers:
        - 127.0.0.1:9092
  topics:
    ClusterA:
      cluster: test
    ClusterA-dlq:
      cluster: test
    ClusterB:
      cluster: test
    ClusterB-dlq:
      cluster: test
  temporal-cluster-topics:
    ClusterA:
      topic: ClusterA
      dlq-topic: ClusterA-dlq
    ClusterB:
      topic: ClusterB
      dlq-topic: ClusterB-dlq

publicClient:
  hostPort: "localhost:8933"

The documentation on setting up Temporal with CrossDC setup is very thin at the moment but we will provide more content around it after our V1 release.

Thanks @samar i was under impression that i can create a global namespace by just setting the global = true while creating namespace :smiley:

Thanks for clarifying that the server got to be configured to accept global namespace registration.

Hey @madhu,
Global namespace requires running Temporal with CrossDC setup.