Using the Simulate Transmission Delegate
The Simulate Transmission Delegate is configured as the default transmission delegate for the Regulatory Transmission Delegate Interface. If a regulatory transmission delegate is not registered for a type of regulatory submission, then, the simulate transmission delegate is used for that type by default. The Simulate Transmission Delegate does not perform any initialization function. It performs a sample transmission function that can be used in testing. Production implementations should always have a transmission delegate registered for a type of regulatory submission. The Simulate Transmission Delegate has an empty void initialize () method and a boolean transmit(RegulatorySubmission regulatorySubmission) method. The boolean transmit(RegulatorySubmission regulatorySubmission) logs errors indicating that the method was invoked, and also logs the content of the regulatory submission payload.
Simulate Transmission Delegate Code
The following example shows the two methods in Simulate Transmission Delegate:
@Override
public void initialize() throws Exception {
// Do nothing
}

@Override
public boolean transmit(RegulatorySubmission regulatorySubmission) throws Exception {
// Do nothing this is a simulator but log to prove it did something
if (logger.isErrorEnabled()) {
logger.error("Entering SimulateTransmissionDelegate ok if Dev");
ContentItem regulatoryContent = RegulatoryContentHelper.getService().getRegulatoryContent(
regulatorySubmission,
RegulatoryContentCategory.REGULATORY_SUBMISSION_PAYLOAD);

if (regulatoryContent instanceof ApplicationData) {
InputStream payloadStream = ContentServerHelper.service
.findContentStream((ApplicationData) regulatoryContent);
String payloadString = new String(payloadStream.readAllBytes(), StandardCharsets.UTF_8);
logger.error("Using SimulateTransmissionDelegate ok if Dev\r\n" + payloadString);
}
}
return true;
}
도움이 되셨나요?