Commit ea9cbda0 authored by Anastasiia Gelmut's avatar Anastasiia Gelmut Committed by Riabokon Stanislav(EPAM)[GCP]
Browse files

Schema: Implement Event Publishing for GCP (GONRG-2378)

parent 094228e2
......@@ -350,7 +350,6 @@ The following software have components provided under the terms of this license:
- Google OAuth Client Library for Java (from )
- Gson (from https://github.com/google/gson)
- Guava InternalFutureFailureAccess and InternalFutures (from )
- Guava ListenableFuture only (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
......@@ -554,6 +553,7 @@ The following software have components provided under the terms of this license:
- ion-java (from https://github.com/amznlabs/ion-java/)
- jackson-databind (from http://github.com/FasterXML/jackson)
- jackson-databind (from http://github.com/FasterXML/jackson)
- jakarta.xml.bind-api (from )
- java-cloudant (from https://cloudant.com)
- java-cloudant (from https://cloudant.com)
- javatuples (from http://www.javatuples.org)
......@@ -611,7 +611,7 @@ The following software have components provided under the terms of this license:
- Hamcrest Core (from http://hamcrest.org/)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Lucene Common Analyzers (from )
- StAX (from http://stax.codehaus.org/)
- Reflections (from http://github.com/ronmamo/reflections)
- Stax2 API (from http://github.com/FasterXML/stax2-api)
- ThreeTen backport (from https://www.threeten.org/threetenbp)
......@@ -623,16 +623,13 @@ The following software have components provided under the terms of this license:
- API Common (from https://github.com/googleapis)
- ASM Core (from )
- ASM Core (from )
- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/)
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- GAX (Google Api eXtensions) (from https://github.com/googleapis)
- GAX (Google Api eXtensions) (from https://github.com/googleapis)
- GAX (Google Api eXtensions) (from https://github.com/googleapis)
- Google APIs Client Library for Java (from )
- Google Auth Library for Java - Credentials (from )
- Google Auth Library for Java - OAuth2 HTTP (from )
- Hamcrest (from http://hamcrest.org/JavaHamcrest/)
- Hamcrest Core (from http://hamcrest.org/)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- JavaBeans Activation Framework API jar (from )
- Lucene Common Analyzers (from )
- Lucene Core (from )
......@@ -647,12 +644,10 @@ The following software have components provided under the terms of this license:
- Netty/Codec/HTTP (from )
- Protocol Buffer Java API (from https://developers.google.com/protocol-buffers/)
- Protocol Buffers [Util] (from )
- Reflections (from http://github.com/ronmamo/reflections)
- SnakeYAML (from http://www.snakeyaml.org)
- Spring Core (from https://github.com/spring-projects/spring-framework)
- Stax2 API (from http://github.com/FasterXML/stax2-api)
- ThreeTen backport (from https://www.threeten.org/threetenbp)
- google (from http://breakingcode.wordpress.com/)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- jakarta.xml.bind-api (from )
========================================================================
......@@ -677,6 +672,14 @@ CC0-1.0
========================================================================
The following software have components provided under the terms of this license:
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
- Netty/Common (from )
- Netty/Common (from )
- reactive-streams (from http://www.reactive-streams.org/)
========================================================================
......@@ -684,15 +687,17 @@ CDDL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Apache Log4j Core (from )
- JavaBeans(TM) Activation Framework (from http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp)
- JavaMail API (from )
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
========================================================================
CDDL-1.1
========================================================================
The following software have components provided under the terms of this license:
- JavaBeans Activation Framework (from )
- JSR 353 (JSON Processing) API (from http://json-processing-spec.java.net)
- JSR 353 (JSON Processing) Default Provider (from http://jsonp.java.net)
- JavaBeans(TM) Activation Framework (from http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp)
- tomcat-embed-core (from http://tomcat.apache.org/)
......@@ -704,6 +709,14 @@ The following software have components provided under the terms of this license:
- JUnit (from http://junit.org)
- JUnit (from http://junit.org)
========================================================================
DOC
========================================================================
The following software have components provided under the terms of this license:
- Woodstox (from https://github.com/FasterXML/woodstox)
- aalto-xml (from )
========================================================================
EPL-1.0
========================================================================
......@@ -711,16 +724,13 @@ The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- Logback Classic Module (from )
- Logback Contrib :: JSON :: Classic (from )
- Logback Contrib :: JSON :: Core (from )
- Logback Contrib :: Jackson (from )
- Logback Core Module (from )
- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- SnakeYAML (from http://www.snakeyaml.org)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
......@@ -749,18 +759,14 @@ GPL-2.0-only
========================================================================
The following software have components provided under the terms of this license:
- JavaBeans Activation Framework (from )
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JSR 353 (JSON Processing) API (from http://json-processing-spec.java.net)
- JSR 353 (JSON Processing) Default Provider (from http://jsonp.java.net)
- JavaMail API (from )
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
GPL-2.0-or-later
========================================================================
The following software have components provided under the terms of this license:
- SnakeYAML (from http://www.snakeyaml.org)
========================================================================
GPL-2.0-with-classpath-exception
========================================================================
......@@ -768,10 +774,11 @@ The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JavaBeans Activation Framework (from )
- Google Guice - Core Library (from )
- JSR 353 (JSON Processing) API (from http://json-processing-spec.java.net)
- JSR 353 (JSON Processing) Default Provider (from http://jsonp.java.net)
- JavaMail API (from )
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
......@@ -780,10 +787,17 @@ GPL-3.0-only
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- Project Lombok (from https://projectlombok.org)
- Project Lombok (from https://projectlombok.org)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
========================================================================
ImageMagick
========================================================================
The following software have components provided under the terms of this license:
- Stax2 API (from http://github.com/FasterXML/stax2-api)
- Woodstox (from https://github.com/FasterXML/woodstox)
- aalto-xml (from )
========================================================================
JSON
========================================================================
......@@ -800,31 +814,14 @@ The following software have components provided under the terms of this license:
- Java Native Access (from https://github.com/java-native-access/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/)
- Logback Classic Module (from )
- Logback Contrib :: JSON :: Classic (from )
- Logback Contrib :: JSON :: Core (from )
- Logback Contrib :: Jackson (from )
- Logback Core Module (from )
- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
========================================================================
LGPL-2.1-or-later
========================================================================
The following software have components provided under the terms of this license:
- SnakeYAML (from http://www.snakeyaml.org)
========================================================================
LGPL-3.0-only
========================================================================
The following software have components provided under the terms of this license:
- Apache Log4j API (from )
- Apache Log4j Core (from )
========================================================================
MIT
========================================================================
......@@ -834,6 +831,8 @@ The following software have components provided under the terms of this license:
- AWS Java SDK for AWS License Manager (from https://aws.amazon.com/sdkforjava)
- AWS SDK for Java - Models (from https://aws.amazon.com/sdkforjava)
- Animal Sniffer Annotations (from )
- Apache Log4j SLF4J Binding (from )
- Apache Log4j to SLF4J Adapter (from )
- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Azure Java Client Authentication Library for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
- Azure Java Client Runtime for ARM (from https://github.com/Azure/autorest-clientruntime-for-java)
......@@ -855,6 +854,7 @@ The following software have components provided under the terms of this license:
- Cucumber-JVM: Plugin (from https://repo1.maven.org/maven2/io/cucumber/cucumber-plugin)
- DataTable (from )
- Extensions on Apache Proton-J library (from https://github.com/Azure/qpid-proton-j-extensions)
- Google Guice - Core Library (from )
- JOpt Simple (from http://pholser.github.io/jopt-simple)
- JUL to SLF4J bridge (from http://www.slf4j.org)
- Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
......@@ -878,8 +878,8 @@ The following software have components provided under the terms of this license:
- Microsoft Azure client library for KeyVault Secrets (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure common module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure internal Avro module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://mockito.org)
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org)
- Netty/Codec/HTTP (from )
- Netty/Codec/HTTP (from )
- Netty/Common (from )
......@@ -894,6 +894,7 @@ The following software have components provided under the terms of this license:
- azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/)
- botocore (from https://github.com/boto/botocore)
- documentdb-bulkexecutor (from http://azure.microsoft.com/en-us/services/documentdb/)
- jakarta.xml.bind-api (from )
- micrometer-core (from https://github.com/micrometer-metrics/micrometer)
- mockito-inline (from https://github.com/mockito/mockito)
- mockito-junit-jupiter (from https://github.com/mockito/mockito)
......@@ -902,61 +903,35 @@ The following software have components provided under the terms of this license:
- msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java)
- spring-security-core (from http://spring.io/spring-security)
========================================================================
MPL-1.1
========================================================================
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
========================================================================
MPL-2.0
========================================================================
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
- OkHttp (from )
========================================================================
PHP-3.01
========================================================================
The following software have components provided under the terms of this license:
- JavaBeans Activation Framework API jar (from )
- jakarta.xml.bind-api (from )
========================================================================
Public-Domain
========================================================================
The following software have components provided under the terms of this license:
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Joda-Time (from http://www.joda.org/joda-time/)
- Joda-Time (from http://www.joda.org/joda-time/)
- LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
========================================================================
Python-2.0
========================================================================
The following software have components provided under the terms of this license:
- google-auth (from https://github.com/GoogleCloudPlatform/google-auth-library-python)
========================================================================
SPL-1.0
WTFPL
========================================================================
The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
- Reflections (from http://github.com/ronmamo/reflections)
========================================================================
WTFPL
X11
========================================================================
The following software have components provided under the terms of this license:
- Reflections (from http://github.com/ronmamo/reflections)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
========================================================================
public-domain
......@@ -967,9 +942,6 @@ The following software have components provided under the terms of this license:
- AWS Java SDK :: SDK Core (from https://aws.amazon.com/sdkforjava)
- AWS SDK for Java - Models (from https://aws.amazon.com/sdkforjava)
- Asynchronous Http Client (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Joda-Time (from http://www.joda.org/joda-time/)
......@@ -978,14 +950,9 @@ The following software have components provided under the terms of this license:
- Microsoft Azure SDK for EventGrid Management (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java)
- Project Lombok (from https://projectlombok.org)
- Project Lombok (from https://projectlombok.org)
- Spring Web (from https://github.com/spring-projects/spring-framework)
- StAX API (from http://stax.codehaus.org/)
- azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/)
- botocore (from https://github.com/boto/botocore)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- reactive-streams (from http://www.reactive-streams.org/)
========================================================================
unknown
......@@ -993,20 +960,10 @@ unknown
The following software have components provided under the terms of this license:
- Byte Buddy (without dependencies) (from )
- Checker Qual (from https://checkerframework.org)
- JSON in Java (from https://github.com/douglascrockford/JSON-java)
- JUnit (from http://junit.org)
- JUnit (from http://junit.org)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- JavaBeans Activation Framework API jar (from )
- JavaMail API (from )
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- jakarta.xml.bind-api (from )
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-params (from http://junit.org/junit5/)
- org.junit.platform:junit-platform-commons (from http://junit.org/junit5/)
- org.junit.platform:junit-platform-engine (from http://junit.org/junit5/)
- org.junit.vintage:junit-vintage-engine (from http://junit.org/junit5/)
......@@ -42,6 +42,7 @@ In order to run the service locally or remotely, you will need to have the follo
| `PARTITION_API` | ex `http://localhost:8081/api/partition/v1` | Partition service endpoint | no | - |
| `GOOGLE_APPLICATION_CREDENTIALS` | ex `/path/to/directory/service-key.json` | Service account credentials, you only need this if running locally | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
| `GCLOUD_PROJECT` | `******` | Cloud project id, you only need this if running locally | no | https://console.cloud.google.com |
| `gcp.schema-changed.messagingEnabled` | `true` OR `false` | Allows to configure message publishing about schemas changes to Pub/Sub | no | - |
### Run Locally
Check that maven is installed:
......
/*
Copyright 2021 Google LLC
Copyright 2021 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.schema;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan({"org.opengroup.osdu"})
@ConfigurationPropertiesScan
public class GcpSchemaApplication {
public static void main(String[] args) {
SpringApplication.run(GcpSchemaApplication.class, args);
}
}
\ No newline at end of file
/*
Copyright 2021 Google LLC
Copyright 2021 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.schema.configuration;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
@ConfigurationProperties(prefix = "gcp.schema-changed")
@Getter
@ConstructorBinding
public class EventMessagingPropertiesConfig {
private final boolean messagingEnabled;
private final String topicName;
public EventMessagingPropertiesConfig(boolean messagingEnabled, String topicName) {
if (messagingEnabled && StringUtils.isEmpty(topicName)) {
throw new RuntimeException("Missing event messaging configuration.");
}
this.messagingEnabled = messagingEnabled;
this.topicName = topicName;
}
}
/*
Copyright 2021 Google LLC
Copyright 2021 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.schema.impl.messagebus;
import com.google.api.gax.retrying.RetrySettings;
import com.google.cloud.pubsub.v1.Publisher;
import com.google.gson.Gson;
import com.google.protobuf.ByteString;
import com.google.pubsub.v1.ProjectTopicName;
import com.google.pubsub.v1.PubsubMessage;
import com.google.pubsub.v1.PubsubMessage.Builder;
import java.io.IOException;
import java.util.Collections;
import java.util.Objects;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.schema.configuration.EventMessagingPropertiesConfig;
import org.opengroup.osdu.schema.constants.SchemaConstants;
import org.opengroup.osdu.schema.impl.messagebus.model.SchemaPubSubInfo;
import org.opengroup.osdu.schema.logging.AuditLogger;
import org.opengroup.osdu.schema.provider.interfaces.messagebus.IMessageBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.threeten.bp.Duration;
@Component
public class MessageBusImpl implements IMessageBus{
public class MessageBusImpl implements IMessageBus {
private static final RetrySettings RETRY_SETTINGS = RetrySettings.newBuilder()
.setTotalTimeout(Duration.ofSeconds(10))
.setInitialRetryDelay(Duration.ofMillis(5))
.setRetryDelayMultiplier(2)
.setMaxRetryDelay(Duration.ofSeconds(3))
.setInitialRpcTimeout(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(2)
.setMaxRpcTimeout(Duration.ofSeconds(10))
.build();
private Publisher publisher;
@Autowired
private TenantInfo tenantInfo;
@Autowired
private DpsHeaders headers;
@Autowired
private EventMessagingPropertiesConfig eventMessagingPropertiesConfig;
@Autowired
private JaxRsDpsLog logger;
@Autowired
private AuditLogger auditLogger;
@Override
public void publishMessage(String schemaId, String eventType) {
if (this.eventMessagingPropertiesConfig.isMessagingEnabled()) {
this.logger.info(String.format("Generating event of type %s", eventType));
if (Objects.isNull(this.publisher)) {
try {
this.publisher = Publisher.newBuilder(
ProjectTopicName.newBuilder()
.setProject(this.tenantInfo.getProjectId())
.setTopic(this.eventMessagingPropertiesConfig.getTopicName()).build())
.setRetrySettings(RETRY_SETTINGS).build();
} catch (IOException e) {
this.logger.info(SchemaConstants.SCHEMA_NOTIFICATION_FAILED);
this.auditLogger.schemaNotificationFailure(Collections.singletonList(schemaId));
throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Internal error",
"A fatal internal error has occurred.", e);
}
}
PubsubMessage message = createMessage(schemaId, eventType);
this.publisher.publish(message);
this.auditLogger.schemaNotificationSuccess(Collections.singletonList(schemaId));
} else {
this.logger.info(SchemaConstants.SCHEMA_NOTIFICATION_IS_DISABLED);
}
}
private PubsubMessage createMessage(String schemaId, String eventType) {
SchemaPubSubInfo schemaPubSubMsg = new SchemaPubSubInfo(schemaId, eventType);
@Autowired
private JaxRsDpsLog logger;
String json = new Gson().toJson(schemaPubSubMsg);
ByteString data = ByteString.copyFromUtf8(json);
@Override
public void publishMessage(String schemaId, String eventType) {
// TODO Auto-generated method stub
logger.warning("publish message not implemented yet");
Builder messageBuilder = PubsubMessage.newBuilder();
messageBuilder.putAttributes(DpsHeaders.ACCOUNT_ID, this.tenantInfo.getName());
messageBuilder.putAttributes(DpsHeaders.DATA_PARTITION_ID,
this.headers.getPartitionIdWithFallbackToAccountId());
this.headers.addCorrelationIdIfMissing();
messageBuilder.putAttributes(DpsHeaders.CORRELATION_ID, this.headers.getCorrelationId());
messageBuilder.setData(data);
}
return messageBuilder.build();
}
}
\ No newline at end of file
}
/*
Copyright 2021 Google LLC
Copyright 2021 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.schema.impl.messagebus.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SchemaPubSubInfo {
private String kind;
private String op;
}
......@@ -13,3 +13,6 @@ shared.tenant.name=common
google.audiences=123.apps.googleusercontent.com
partition.api=http://localhost:8081/api/partition/v1
gcp.schema-changed.messagingEnabled=false
gcp.schema-changed.topicName=topicName
\ No newline at end of file
/*
Copyright 2021 Google LLC
Copyright 2021 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0