Websub improvements #105

Merged
Maece97 merged 3 commits from websub-improvements into dev 2021-12-15 11:11:04 +00:00
5 changed files with 5 additions and 14 deletions
Showing only changes of commit 4593e5bddb - Show all commits

View File

@ -67,6 +67,8 @@ services:
- ./:/data/ - ./:/data/
environment: environment:
mqtt.broker.uri: tcp://broker.hivemq.com:1883 mqtt.broker.uri: tcp://broker.hivemq.com:1883
discovery.endpoint.uri: https://tapas-auction-house.86.119.35.213.nip.io/discovery/
auction.house.uri: https://tapas-auction-house.86-119-35-40.nip.io
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.tapas-auction-house.rule=Host(`tapas-auction-house.${PUB_IP}.nip.io`)" - "traefik.http.routers.tapas-auction-house.rule=Host(`tapas-auction-house.${PUB_IP}.nip.io`)"

View File

@ -44,7 +44,7 @@ public class TapasAuctionHouseApplication {
private static void bootstrapMarketplaceWithWebSub() { private static void bootstrapMarketplaceWithWebSub() {
discoverAuctionHouseEndpoints(); discoverAuctionHouseEndpoints();
WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auctionhouse.uri")); WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auction.house.uri"));
for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) { for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) {
subscriber.subscribeToAuctionHouseEndpoint(endpoint.getWebSubUri().getValue()); subscriber.subscribeToAuctionHouseEndpoint(endpoint.getWebSubUri().getValue());

View File

@ -14,7 +14,7 @@ public class DiscoverWebSubAdapter {
@Value("${websub.hub.uri}") @Value("${websub.hub.uri}")
private String webSubHubUri; private String webSubHubUri;
@Value("${auctionhouse.uri}") @Value("${auction.house.uri}")
private String auctionHouseUri; private String auctionHouseUri;
/** /**

View File

@ -1,29 +1,19 @@
package ch.unisg.tapas.auctionhouse.adapter.out.messaging.websub; package ch.unisg.tapas.auctionhouse.adapter.out.messaging.websub;
import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort; import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort;
import ch.unisg.tapas.auctionhouse.domain.Auction;
import ch.unisg.tapas.auctionhouse.domain.AuctionStartedEvent; import ch.unisg.tapas.auctionhouse.domain.AuctionStartedEvent;
import ch.unisg.tapas.common.ConfigProperties;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors;
/** /**
* This class is a template for publishing auction started events via WebSub. * This class is a template for publishing auction started events via WebSub.
@ -31,7 +21,7 @@ import java.util.stream.Collectors;
@Component @Component
@Primary @Primary
public class PublishAuctionStartedEventWebSubAdapter implements AuctionStartedEventPort { public class PublishAuctionStartedEventWebSubAdapter implements AuctionStartedEventPort {
@Value("${auctionhouse.uri}") @Value("${auction.house.uri}")
private String auctionHouseUri; private String auctionHouseUri;
@Value("${websub.hub.uri}") @Value("${websub.hub.uri}")

View File

@ -10,7 +10,6 @@ auction.house.uri=https://tapas-auction-house.86-119-35-40.nip.io
tasks.list.uri=http://localhost:8081 tasks.list.uri=http://localhost:8081
application.environment=development application.environment=development
auctionhouse.uri=http://fe10-77-59-152-182.eu.ngrok.io
websub.hub.uri=https://pubsubhubbub.appspot.com websub.hub.uri=https://pubsubhubbub.appspot.com
mqtt.broker.uri=tcp://localhost:1883 mqtt.broker.uri=tcp://localhost:1883