use of com.wavefront.agent.data.SourceTagSubmissionTask in project java by wavefrontHQ.
the class QueueExporter method processTask.
@VisibleForTesting
<T extends DataSubmissionTask<T>> void processTask(T task, BufferedWriter writer) throws IOException {
if (task instanceof LineDelimitedDataSubmissionTask) {
for (String line : ((LineDelimitedDataSubmissionTask) task).payload()) {
writer.write(line);
writer.newLine();
}
} else if (task instanceof SourceTagSubmissionTask) {
writer.write(((SourceTagSubmissionTask) task).payload().toString());
writer.newLine();
} else if (task instanceof EventDataSubmissionTask) {
for (Event event : ((EventDataSubmissionTask) task).payload()) {
writer.write(event.toString());
writer.newLine();
}
}
}
use of com.wavefront.agent.data.SourceTagSubmissionTask in project java by wavefrontHQ.
the class InstrumentedTaskQueueDelegateTest method testSourceTagTask.
@Test
public void testSourceTagTask() throws Exception {
for (RetryTaskConverter.CompressionType type : RetryTaskConverter.CompressionType.values()) {
System.out.println("SourceTag task, compression type: " + type);
File file = new File(File.createTempFile("proxyTestConverter", null).getPath() + ".queue");
file.deleteOnExit();
TaskQueue<SourceTagSubmissionTask> queue = getTaskQueue(file, type);
queue.clear();
SourceTagSubmissionTask task = new SourceTagSubmissionTask(null, new DefaultEntityPropertiesForTesting(), queue, "2878", new SourceTag(ReportSourceTag.newBuilder().setOperation(SourceOperationType.SOURCE_TAG).setAction(SourceTagAction.SAVE).setSource("testSource").setAnnotations(ImmutableList.of("newtag1", "newtag2")).build()), () -> 77777L);
task.enqueue(QueueingReason.RETRY);
queue.close();
TaskQueue<SourceTagSubmissionTask> readQueue = getTaskQueue(file, type);
SourceTagSubmissionTask readTask = readQueue.peek();
assertEquals(task.payload(), readTask.payload());
assertEquals(77777, readTask.getEnqueuedMillis());
}
}
Aggregations