bugfixes
This commit is contained in:
parent
9a2139036e
commit
3fb5bc40bc
|
@ -67,7 +67,7 @@ services:
|
||||||
- ./:/data/
|
- ./:/data/
|
||||||
environment:
|
environment:
|
||||||
mqtt.broker.uri: tcp://broker.hivemq.com:1883
|
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
|
auction.house.uri: https://tapas-auction-house.86-119-35-40.nip.io
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
|
|
|
@ -46,8 +46,6 @@ public class TapasAuctionHouseApplication {
|
||||||
* Discovers auction houses and subscribes to WebSub notifications
|
* Discovers auction houses and subscribes to WebSub notifications
|
||||||
*/
|
*/
|
||||||
private static void bootstrapMarketplaceWithWebSub() {
|
private static void bootstrapMarketplaceWithWebSub() {
|
||||||
discoverAuctionHouseEndpoints();
|
|
||||||
|
|
||||||
WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auction.house.uri"));
|
WebSubSubscriber subscriber = new WebSubSubscriber(ENVIRONMENT.getProperty("auction.house.uri"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -57,6 +55,8 @@ public class TapasAuctionHouseApplication {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
discoverAuctionHouseEndpoints();
|
||||||
|
|
||||||
// for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) {
|
// for (AuctionHouseDiscoveryInformation endpoint : AuctionHouseDiscovery.getInstance().getAuctionHouseDiscoveryList()) {
|
||||||
// System.out.println(endpoint.getWebSubUri().getValue());
|
// System.out.println(endpoint.getWebSubUri().getValue());
|
||||||
// if (!endpoint.getWebSubUri().getValue().toString().equalsIgnoreCase("https://tapas-auction-house.86-119-35-40.nip.io/websub/auctions")) {
|
// if (!endpoint.getWebSubUri().getValue().toString().equalsIgnoreCase("https://tapas-auction-house.86-119-35-40.nip.io/websub/auctions")) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -30,27 +31,31 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
|
||||||
.uri(auctionHouseURI)
|
.uri(auctionHouseURI)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
LOGGER.info(response.body());
|
LOGGER.info("Response status code: " + response.statusCode());
|
||||||
var responseBody = new JSONObject(response.body());
|
LOGGER.info("Response body:" + response.body());
|
||||||
|
if (response.statusCode() == HttpStatus.OK.value()) {
|
||||||
|
var responseBody = new JSONObject(response.body());
|
||||||
|
|
||||||
var arrayOfInformation = responseBody.getJSONArray("auctionHouseInfo");
|
var arrayOfInformation = responseBody.getJSONArray("auctionHouseInfo");
|
||||||
var returnList = new LinkedList<AuctionHouseDiscoveryInformation>();
|
var returnList = new LinkedList<AuctionHouseDiscoveryInformation>();
|
||||||
|
|
||||||
for(int i = 0; i < arrayOfInformation.length(); i++)
|
for(int i = 0; i < arrayOfInformation.length(); i++)
|
||||||
{
|
{
|
||||||
var informationJSON = arrayOfInformation.getJSONObject(i);
|
var informationJSON = arrayOfInformation.getJSONObject(i);
|
||||||
var information = new AuctionHouseDiscoveryInformation(
|
var information = new AuctionHouseDiscoveryInformation(
|
||||||
new AuctionHouseDiscoveryInformation.AuctionHouseUri(URI.create(informationJSON.getString("auctionHouseUri"))),
|
new AuctionHouseDiscoveryInformation.AuctionHouseUri(URI.create(informationJSON.getString("auctionHouseUri"))),
|
||||||
new AuctionHouseDiscoveryInformation.WebSubUri(URI.create(informationJSON.getString("webSubUri"))),
|
new AuctionHouseDiscoveryInformation.WebSubUri(URI.create(informationJSON.getString("webSubUri"))),
|
||||||
new AuctionHouseDiscoveryInformation.TaskTypes(getTaskTypes(informationJSON.getJSONArray("taskTypes"))),
|
new AuctionHouseDiscoveryInformation.TaskTypes(getTaskTypes(informationJSON.getJSONArray("taskTypes"))),
|
||||||
new AuctionHouseDiscoveryInformation.TimeStamp(Timestamp.valueOf(informationJSON.getString("timeStamp"))),
|
new AuctionHouseDiscoveryInformation.TimeStamp(Timestamp.valueOf(informationJSON.getString("timeStamp"))),
|
||||||
new AuctionHouseDiscoveryInformation.GroupName(informationJSON.getString("groupName"))
|
new AuctionHouseDiscoveryInformation.GroupName(informationJSON.getString("groupName"))
|
||||||
);
|
);
|
||||||
returnList.add(information);
|
returnList.add(information);
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||||
return returnList;
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user