Remove EventMessage support
Events-broker version 3.5.0-alpha-202107290338 does not support
deserialisation of EventMessages.
Bug: Issue 14823
Change-Id: Id666b35617ce4d4f50a2f97385f9987bddfbd05b
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index c5b11fe..9ee1907 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -45,8 +45,8 @@
maven_jar(
name = "events-broker",
- artifact = "com.gerritforge:events-broker:3.4.0.4",
- sha1 = "8d361d863382290e33828116e65698190118d0f1",
+ artifact = "com.gerritforge:events-broker:3.5.0-alpha-202107290338",
+ sha1 = "243ecb0e13c6532a9e3e7ab03d7318cbf350ec77",
)
maven_jar(
diff --git a/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java b/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
index df69922..2a030c9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
@@ -14,7 +14,6 @@
package com.googlesource.gerrit.plugins.pubsub;
-import com.gerritforge.gerrit.eventbroker.EventMessage;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutureCallback;
import com.google.api.core.ApiFutures;
@@ -67,10 +66,6 @@
return publish(gson.toJson(event));
}
- public ListenableFuture<Boolean> publish(EventMessage event) {
- return publish(gson.toJson(event));
- }
-
private ListenableFuture<Boolean> publish(String eventPayload) {
ByteString data = ByteString.copyFromUtf8(eventPayload);
PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisherTest.java b/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisherTest.java
index 97a2c8d..d88f9d4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisherTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisherTest.java
@@ -19,13 +19,12 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.gerritforge.gerrit.eventbroker.EventMessage;
import com.google.api.core.ApiFutures;
import com.google.cloud.pubsub.v1.Publisher;
import com.google.gerrit.json.OutputFormat;
+import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.ProjectCreatedEvent;
import java.io.IOException;
-import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,9 +41,7 @@
@Mock PubSubPublisherMetrics pubSubPublisherMetricsMock;
private static final String TOPIC = "foo";
- private static final EventMessage eventMessage =
- new EventMessage(
- new EventMessage.Header(UUID.randomUUID(), UUID.randomUUID()), new ProjectCreatedEvent());
+ private static final Event eventMessage = new ProjectCreatedEvent();
@Before
public void setUp() throws IOException {