Skip to content

Commit

Permalink
Merge pull request #7 from glascaleia/master
Browse files Browse the repository at this point in the history
Added WebSocketBase Implementation for AWS Cloud
  • Loading branch information
fizzi authored Oct 12, 2021
2 parents 4b23ea3 + db7c7db commit a43f1ab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
Expand All @@ -301,7 +302,7 @@
/**
* @author Francesco Izzi @ CNR IMAA geoSDI
*/

@Profile(value = "stomp")
@Component(value = "dpcSessionHandler")
public class DPCRadarDataStompSessionHandler extends StompSessionHandlerAdapter implements InitializingBean {

Expand All @@ -311,7 +312,7 @@ public class DPCRadarDataStompSessionHandler extends StompSessionHandlerAdapter
public String productToDownload;
@Value("${defaultSavePath}")
public String defaultSavePath;
private final String DOWNLOAD_PRODUCT_URL = "https://radar.protezionecivile.gov.it/wide-api/wide/product/downloadProduct";
private final String DOWNLOAD_PRODUCT_URL = "https://radar-api.protezionecivile.it/wide/product/downloadProduct";
private StompClient stompClient;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,16 @@
*/
package gov.protezionecivile.radar.downloader;

import java.util.Date;

/**
* @author Francesco Izzi @ CNR IMAA geoSDI
*/

public class DPCWebsocketMessage {

private String productType;
private String time;
private Date time;
private String period;

public String getProductType() {
Expand All @@ -294,11 +296,11 @@ public void setProductType(String productType) {
this.productType = productType;
}

public String getTime() {
public Date getTime() {
return time;
}

public void setTime(String time) {
public void setTime(Date time) {
this.time = time;
}

Expand All @@ -314,7 +316,7 @@ public String toJsonString(){

return "{" +
"\"productType\":"+"\"" + getProductType() +"\"," +
"\"productDate\":"+ getTime() +
"\"productDate\":"+ getTime().getTime() +
"}";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Profile;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
Expand All @@ -295,13 +296,13 @@
/**
* @author Francesco Izzi @ CNR IMAA geoSDI
*/

@Profile(value = "stomp")
@Component
public class StompClient {

private static final Logger logger = LogManager.getLogger(StompClient.class);
//
private static String RADAR_WEBSOCKET_URL = "wss://radar.protezionecivile.gov.it/wide-websocket";
protected static String RADAR_WEBSOCKET_URL = "wss://8ielgrmwo6.execute-api.eu-south-1.amazonaws.com/Prod";

@Autowired
@Qualifier(value = "dpcSessionHandler")
Expand Down
5 changes: 3 additions & 2 deletions java/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
productToDownload = HRD,LTG
defaultSavePath = /Users/francescoizzi/Desktop/DATI_RADAR/
productToDownload=HRD,LTG,SRI,SRT3,VMI,SRT1,IR108
defaultSavePath=/Users/glascaleia/Desktop/DATI_RADAR/
spring.profiles.active=without_stomp

0 comments on commit a43f1ab

Please sign in to comment.