Child pages
  • Implementing a Pull-Forward Data-Adapter
Skip to end of metadata
Go to start of metadata

Pull-Forward Data-Adapter are required if it is not possible (or not wanted) to build and deploy a plugin to the data provider that pushes data changes to a Push-Forward Data-Adapter. Therefore the main design idea is that this adapter pulls data from the data-provider on a regular basis.

Creating the Timer-EJB (adapter core)

Timer EJB
@Startup
@Singleton
public class PullForwardControllerBean {
 	@Schedule(second="*/30", minute="*",hour="*", persistent=false)
    public void pullData(){
		String eom = "";
		String metricRef = "my.metric.identifier";
		double value = 0.0;

		// Get Data From remote location
		List<Data> allData = getDataFromRemoteLocation();
		for (Data data : allData) {
			eom = data.getEom();
			value = data.getValue();

			try {
				sender.sendMeasure(eom, metricRef, value, "");

				// Logging for Monitoring
				Long messageSize = 4;
				monitoring.notifyEMDBMessageSend(BusType.Measures, metricRef, messageSize);
			} catch (JMSException e) {
				Logger.getLogger(EMDBMeasurementRestGatewayBean.class.getName()).severe(e.getMessage());
				logError(e);
			} catch (JAXBException e) {
				Logger.getLogger(EMDBMeasurementRestGatewayBean.class.getName()).severe(e.getMessage());
				logError(e);
			}
		}
    }
}

This pulls data from a remote data provider every 30 seconds.

  • No labels