@Override public Schema getSchema() { return GenericIndexedRecordConverter.this.getSchema(); }
@Override public void write(Object object) throws IOException { String content; if (object == null) return; cleanWrites(); result.totalCount++; if (writeSchema == null) { writeSchema = ((IndexedRecord) object).getSchema(); } GenericIndexedRecordConverter factory = new GenericIndexedRecordConverter(); factory.setSchema(writeSchema); IndexedRecord inputRecord = factory.convertToAvro((IndexedRecord) object); Field msgContent = writeSchema.getField(AzureStorageQueueProperties.FIELD_MESSAGE_CONTENT); int ttl = props.timeToLiveInSeconds.getValue(); int visibility = props.initialVisibilityDelayInSeconds.getValue(); if (msgContent == null) { LOGGER.error(i18nMessages.getMessage("error.VacantMessage")); if (props.dieOnError.getValue()) { throw new ComponentException(new Exception(i18nMessages.getMessage("error.VacantMessage"))); } } else { content = (String) inputRecord.get(msgContent.pos()); messagesBuffer.add(new QueueMessage(new CloudQueueMessage(content), ttl, visibility)); } if (messagesBuffer.size() >= MAX_MSG_TO_ENQUEUE) { sendParallelMessages(); } }
public IndexedRecordConverter<IndexedRecord, IndexedRecord> getFactory(Object datum) { if (null == factory) { factory = new GenericIndexedRecordConverter(); factory.setSchema(((IndexedRecord) datum).getSchema()); } return factory; } }
@Override public void write(Object object) throws IOException { String content; if (object == null) return; cleanWrites(); result.totalCount++; if (writeSchema == null) { writeSchema = ((IndexedRecord) object).getSchema(); } GenericIndexedRecordConverter factory = new GenericIndexedRecordConverter(); factory.setSchema(writeSchema); IndexedRecord inputRecord = factory.convertToAvro((IndexedRecord) object); Field msgContent = writeSchema.getField(AzureStorageQueueProperties.FIELD_MESSAGE_CONTENT); int ttl = props.timeToLiveInSeconds.getValue(); int visibility = props.initialVisibilityDelayInSeconds.getValue(); if (msgContent == null) { LOGGER.error(i18nMessages.getMessage("error.VacantMessage")); if (props.dieOnError.getValue()) { throw new ComponentException(new Exception(i18nMessages.getMessage("error.VacantMessage"))); } } else { content = (String) inputRecord.get(msgContent.pos()); messagesBuffer.add(new QueueMessage(new CloudQueueMessage(content), ttl, visibility)); } if (messagesBuffer.size() >= MAX_MSG_TO_ENQUEUE) { sendParallelMessages(); } }
public IndexedRecordConverter<IndexedRecord, IndexedRecord> getFactory(Object datum) { if (null == factory) { factory = new GenericIndexedRecordConverter(); factory.setSchema(((IndexedRecord) datum).getSchema()); } return factory; } }
@Override public Schema getSchema() { return GenericIndexedRecordConverter.this.getSchema(); }