Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor google pubsub implementation #190

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
<version>${spring-cloud-gcp.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

package org.rutebanken.tiamat.changelog;

import org.rutebanken.tiamat.config.GooglePubSubConfig;
import com.google.cloud.spring.pubsub.core.PubSubTemplate;
import org.rutebanken.tiamat.model.EntityInVersionStructure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -29,15 +29,18 @@
public class EntityChangedEventPubSubPublisher extends EntityChangedEventPublisher implements EntityChangedListener {

@Autowired
private GooglePubSubConfig.PubsubOutboundGateway pubsubOutboundGateway;
private PubSubTemplate pubSubTemplate;

@Value("${changelog.topic.name:ror.tiamat.changelog}")
private String pubSubTopic;

@Value("${changelog.gcp.publish.enabled:true}")
private boolean pubSubPublish;

@Override
public void onChange(EntityInVersionStructure entity) {
if (pubSubPublish && isLoggedEntity(entity)) {
pubsubOutboundGateway.sendToPubsub(toEntityChangedEvent(entity, false).toString());
pubSubTemplate.publish(pubSubTopic,toEntityChangedEvent(entity, false).toString());
}

}
Expand All @@ -46,7 +49,7 @@ public void onChange(EntityInVersionStructure entity) {
public void onDelete(EntityInVersionStructure entity) {

if (pubSubPublish && isLoggedEntity(entity)) {
pubsubOutboundGateway.sendToPubsub(toEntityChangedEvent(entity, true).toString());
pubSubTemplate.publish(pubSubTopic,toEntityChangedEvent(entity, true).toString());
}
}
}
29 changes: 0 additions & 29 deletions src/main/java/org/rutebanken/tiamat/config/GooglePubSubConfig.java

This file was deleted.

Loading