Edge Data Streaming
- Edge Data Streaming 2.3.2
- All Products
package ...; import java.io.IOException; import com.informatica.vds.api.VDSConfiguration; import com.informatica.vds.api.VDSEventList; import com.informatica.vds.api.VDSSource; public class CustomSource implements VDSSource { /* Initialize the VDSSource object. */ @Override public void open(VDSConfiguration vdsconfiguration) throws Exception { /* The internal name of the key. */ String fieldName = "SourceURLFromUI"; /* The default value of the key. */ String defaultValue = "SourceURLDefault"; /* Retrieve the value of the key SourceURLFromUI. */ String SourceURL = vdsconfiguration.optString("SourceURLFromUI", "SourceURLDefault"); /* Similarly, retrieve other keys. */ ... } /* Read the data from the data source. */ @Override public void read(VDSEventList vdsevents) throws Exception { /* Collect data into a byte array called data. */ ... /* Add the generated data to the VDSEventList object. */ vdsevents.addEvent(data, data.length); } @Override public void close() throws IOException { /* Clean up. */ ... } @Override public void setRetryPolicyHandler(IPluginRetryPolicy arg0) { // TODO Auto-generated method stub } }
package ...; import java.io.IOException; import com.informatica.vds.api.VDSConfiguration; import com.informatica.vds.api.VDSEventList; import com.informatica.vds.api.VDSSource; public class CustomSource implements VDSSource { /* Initialize the VDSSource object. */ @Override public void open(VDSConfiguration vdsconfiguration) throws Exception { /* The internal name of the key. */ String fieldName = "SourceURLFromUI"; /* The default value of the key. */ String defaultValue = "SourceURLDefault"; /* Retrieve the value of the key SourceURLFromUI. */ String SourceURL = vdsconfiguration.optString("SourceURLFromUI", "SourceURLDefault"); /* Similarly, retrieve other keys. */ ... } /* Read the data from the data source. */ @Override public void read(VDSEventList arg0) throws Exception { System.out.println("Reading source..."); Thread.sleep(10); String message = (String) queue.poll(); if (message == null) { return; } count++; Map<String, String> map = new HashMap(); if (count % 2 == 0) { map.put("transportTopic", "TwoTopic"); } else if (count % 3 == 0) { map.put("transportTopic", "ThreeTopic"); } else { map.put("transportTopic", "OtherTopic"); } arg0.addEvent(message.getBytes(), message.getBytes().length, map); if (count % 2 == 0) { statValues.put((short)2, ++twos); } if (count % 3 == 0) { statValues.put((short)3, ++threes); } System.out.println("Data " + message.getBytes() + " " + message.getBytes().length); } @Override public void close() throws IOException { /* Clean up. */ ... } @Override public void setRetryPolicyHandler(IPluginRetryPolicy arg0) { // TODO Auto-generated method stub } }