This commit is contained in:
Marcel 2021-12-19 19:35:20 +01:00
parent 9a2139036e
commit 3fb5bc40bc
3 changed files with 26 additions and 21 deletions

View File

@ -67,7 +67,7 @@ services:
- ./:/data/
environment:
mqtt.broker.uri: tcp://broker.hivemq.com:1883
discovery.endpoint.uri: http://tapas-auction-house.86-119-34-242.nip.io/
discovery.endpoint.uri: http://tapas-auction-house.86-119-34-242.nip.io
auction.house.uri: https://tapas-auction-house.86-119-35-40.nip.io
labels:
- "traefik.enable=true"

View File

@ -46,8 +46,6 @@ public class TapasAuctionHouseApplication {
* Discovers auction houses and subscribes to WebSub notifications
*/
private static void bootstrapMarketplaceWithWebSub() {
discoverAuctionHouseEndpoints();
WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auction.house.uri"));
try {
@ -57,6 +55,8 @@ public class TapasAuctionHouseApplication {
e.printStackTrace();
}
discoverAuctionHouseEndpoints();
// for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) {
// System.out.println(endpoint.getWebSubUri().getValue());
// if (!endpoint.getWebSubUri().getValue().toString().equalsIgnoreCase("https://tapas-auction-house.86-119-35-40.nip.io/websub/auctions")) {

View File

@ -6,6 +6,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.http.HttpStatus;
import java.io.IOException;
import java.net.URI;
@ -30,8 +31,10 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
.uri(auctionHouseURI)
.GET()
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
LOGGER.info(response.body());
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
LOGGER.info("Response status code: " + response.statusCode());
LOGGER.info("Response body:" + response.body());
if (response.statusCode() == HttpStatus.OK.value()) {
var responseBody = new JSONObject(response.body());
var arrayOfInformation = responseBody.getJSONArray("auctionHouseInfo");
@ -51,6 +54,8 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
}
return returnList;
}
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
} catch (IOException e) {
e.printStackTrace();