Skip to content

Commit

Permalink
Refactor EntityChangedEventPubSubPublisher to use PubsubTemplate inst…
Browse files Browse the repository at this point in the history
…ead for spring-integration-core component. Removed GooglePubSubConfig.java and PubsubOutboundGateway.java, removed spring-integration-core dependency from pom
  • Loading branch information
assadriaz committed Oct 22, 2024
1 parent de3b627 commit d8feaab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 43 deletions.
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.PubsubOutboundGateway;
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 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());
}
}
}
23 changes: 0 additions & 23 deletions src/main/java/org/rutebanken/tiamat/config/GooglePubSubConfig.java

This file was deleted.

This file was deleted.

0 comments on commit d8feaab

Please sign in to comment.