I want to publish messages to a specific region as I want to leverage message ordering.
I am using the following dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>3.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I am using the following property to set the regional endpoint:
spring.cloud.gcp.pubsub.publisher.endpoint=asia-east1-pubsub.googleapis.com:443
However, while publishing the messages using PubSubTemplate, I get the below error.
com.google.api.gax.rpc.UnauthenticatedException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.
Whereas, on not using the regional endpoint (and using the global one) I am able to publish the messages successfully.
What am I doing wrong here?