public abstract class AbstractTaskGenerator extends AbstractStreamingTaskGenerator implements GeneratedDataReceivingComponent
AbstractStreamingTaskGenerator.GeneratedDataHandler| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOGGER |
dataReceiver, generatorId, numberOfGenerators, sender2EvalStore, sender2SystemcmdChannel, cmdQueueFactory, DEFAULT_CMD_RESPONSE_TIMEOUT, defaultContainerTypeconnectionFactory, incomingDataQueueFactory, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, outgoingDataQueuefactory, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY| Constructor and Description |
|---|
AbstractTaskGenerator()
Default constructor creating an
AbstractTaskGenerator processing
up to AbstractStreamingTaskGenerator.DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES=
messages in parallel. |
AbstractTaskGenerator(int maxParallelProcessedMsgs)
Constructor setting the maximum number of parallel processed messages.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
generateTask(byte[] data)
Generates a task from the given data, sends it to the system, takes the
timestamp of the moment at which the message has been sent to the system
and sends it together with the expected response to the evaluation
storage.
|
void |
generateTask(InputStream dataStream)
Generates a task from the given data, sends it to the system, takes the
timestamp of the moment at which the message has been sent to the system and
sends it together with the expected response to the evaluation storage.
|
void |
receiveGeneratedData(byte[] data)
This method is called if data is received from a data generator.
|
protected void |
sendTaskToEvalStorage(String taskIdString,
long timestamp,
byte[] data)
This method sends the given data and the given timestamp of the task with
the given task id to the evaluation storage.
|
protected void |
sendTaskToSystemAdapter(String taskIdString,
byte[] data)
Sends the given task with the given task id and data to the system.
|
close, getGeneratorId, getNextTaskId, getNumberOfGenerators, init, receiveCommand, receiveGeneratedData, run, sendTaskToEvalStorage, sendTaskToSystemAdapteraddContainerObserver, createContainer, getFactoryForIncomingCmdQueues, getFactoryForIncomingDataQueues, getFactoryForOutgoingCmdQueues, getFactoryForOutgoingDataQueues, stopContaineraddCommandHeaderId, createContainer, createContainer, handleCmd, sendToCmdQueue, sendToCmdQueue, sendToCmdQueuecreateConnection, generateSessionQueueName, getHobbitSessionIdclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreceiveGeneratedDatapublic AbstractTaskGenerator()
AbstractTaskGenerator processing
up to AbstractStreamingTaskGenerator.DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES=
messages in parallel.public AbstractTaskGenerator(int maxParallelProcessedMsgs)
AbstractStreamingTaskGenerator.init() method will throw an exception. Setting
maxParallelProcessedMsgs=1 leads to the usage of a
QueueingConsumer.maxParallelProcessedMsgs - the number of messaegs that are processed in parallelpublic void generateTask(InputStream dataStream)
AbstractStreamingTaskGeneratorgenerateTask in class AbstractStreamingTaskGeneratordataStream - stream containing incoming data generated by a data generatorpublic void receiveGeneratedData(byte[] data)
GeneratedDataReceivingComponentreceiveGeneratedData in interface GeneratedDataReceivingComponentdata - the data received from a data generatorprotected abstract void generateTask(byte[] data)
throws Exception
data - incoming data generated by a data generatorException - if a sever error occurredprotected void sendTaskToEvalStorage(String taskIdString, long timestamp, byte[] data) throws IOException
taskIdString - the id of the tasktimestamp - the timestamp of the moment in which the task has been sent to
the systemdata - the expected response for the task with the given idIOException - if there is an error during the sendingprotected void sendTaskToSystemAdapter(String taskIdString, byte[] data) throws IOException
taskIdString - the id of the taskdata - the data of the taskIOException - if there is an error during the sendingCopyright © 2017–2018. All rights reserved.