code: public Long createAndExecuteTask(String taskName, String data, String key1, String key2, boolean inChannel) {
  		FieldValidator.validateTaskData(data);
  		FieldValidator.validateTaskKey1(key1);
  		FieldValidator.validateTaskKey2(key2);
  		TaskConfig tc = context.registry.getTaskConfig(taskName);
  		if (tc == null)
  			throw new IllegalArgumentException("Task '" + taskName + "' is not known for TED");
  		Long taskId = context.tedDao.createTaskWithWorkStatus(taskName, tc.channel, data, key1, key2);
  		TaskRec taskRec = new TaskRec();
  		taskRec.taskId = taskId;
  		taskRec.batchId = null;
  		taskRec.system = context.config.systemId();
  		taskRec.name = taskName;
  		taskRec.status = TedStatus.WORK.toString();
  		taskRec.channel = tc.channel;
  		taskRec.nextTs = new Date();
  		taskRec.retries = 0;
  		taskRec.key1 = key1;
  		taskRec.key2 = key2;
  		taskRec.data = data;
  		taskRec.createTs = new Date();
  		taskRec.startTs = new Date();
  		taskRec.finishTs = null;
  		if (inChannel) {
  			// in separate thread
  			context.taskManager.sendTaskListToChannels(Collections.singletonList(taskRec));
  		} else {
  			// in this thread
  			context.taskManager.processTask(taskRec);
  		}
  		return taskId;
  	}
docs: (or add task to execution queue - channel)