Skip to content

Commit

Permalink
Beacon implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dima767 committed Jan 15, 2020
1 parent 003b63e commit 8453a69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public void run() {

}

//Below are package-private getters used in unit tests
String getEndpointUri() {
//getters used in unit tests and calling components for debugging purposes
public String getEndpointUri() {
return enpointUrl.toString();
}

String getJsonPayload() {
public String getJsonPayload() {
return jsonPayload;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package edu.internet2.tap.beacon.configuration;

import edu.internet2.tap.beacon.BeaconPublisher;
import edu.internet2.tap.beacon.DefaultBeaconPublisher;
import edu.internet2.tap.beacon.configuration.condition.ConditionalOnBeaconEnvironmentVariablesPresent;
import org.slf4j.Logger;
Expand Down Expand Up @@ -43,17 +42,19 @@ public BeaconPublishingTask beaconPublisher(Environment env) {
}

public static class BeaconPublishingTask {
private DefaultBeaconPublisher beaconPublisher;

private BeaconPublisher beaconPublisher;

public BeaconPublishingTask(BeaconPublisher beaconPublisher) {
public BeaconPublishingTask(DefaultBeaconPublisher beaconPublisher) {
this.beaconPublisher = beaconPublisher;
}

//Cron is based on the spec defined here: https://spaces.at.internet2.edu/display/TWGH/TIER+Instrumentation+-+The+TIER+Beacon
@Scheduled(cron = "0 ${random.int[0,59]} ${random.int[0,3]} ? * *}")
@Async
void publish() {
logger.debug("Publishing payload: {} to beacon endpoint: {}",
beaconPublisher.getJsonPayload(),
beaconPublisher.getEndpointUri());
beaconPublisher.run();
}
}
Expand Down

0 comments on commit 8453a69

Please sign in to comment.