Related to #20935
Replace with try{i = parse}catch{} if i not null output
|
@ProcessElement |
|
public void processElement(ProcessContext context) { |
|
String msgId = context.element(); |
|
try { |
|
context.output(client.fetchMessage(msgId)); |
|
} catch (Exception e) { |
|
context.output(HL7v2IO.Read.DEAD_LETTER, HealthcareIOError.of(msgId, e)); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
@ProcessElement |
|
public void processElement(ProcessContext context) { |
|
String msgId = context.element().getHl7v2MessageId(); |
|
try { |
|
HL7v2ReadResponse response = |
|
HL7v2ReadResponse.of(context.element().getMetadata(), client.fetchMessage(msgId)); |
|
context.output(response); |
|
} catch (Exception e) { |
|
HealthcareIOError<HL7v2ReadParameter> error = |
|
HealthcareIOError.of(context.element(), e); |
|
context.output(HL7v2IO.HL7v2Read.DEAD_LETTER, error); |
|
} |
|
@ProcessElement |
|
public void processElement(ProcessContext context) { |
|
String resourceId = context.element(); |
|
try { |
|
context.output(fetchResource(this.client, resourceId)); |
|
} catch (Exception e) { |
|
READ_RESOURCE_ERRORS.inc(); |
|
LOG.warn( |
|
"Error fetching Fhir resource with ID {} writing to Dead Letter Queue. ", |
|
resourceId, |
|
e); |
|
context.output(FhirIO.Read.DEAD_LETTER, HealthcareIOError.of(resourceId, e)); |
|
} |
|
} |
|
try { |
|
if (reader.start()) { |
|
outputReceiver.get(rowTag).output(reader.getCurrent()); |
|
} else { |
|
return; |
|
} |
|
} catch (ParseException e) { |
|
GenericRecord record = errorHandlingParseFn.getSchemaAndRecord().getRecord(); |
|
badRecordRouter.route( |
|
outputReceiver, |
|
record, |
|
AvroCoder.of(record.getSchema()), |
|
(Exception) e.getCause(), |
|
"Unable to parse record reading from BigQuery"); |
|
} |
|
|
|
while (true) { |
|
try { |
|
if (reader.advance()) { |
|
outputReceiver.get(rowTag).output(reader.getCurrent()); |
|
} else { |
|
return; |
|
} |
|
} catch (ParseException e) { |
|
GenericRecord record = errorHandlingParseFn.getSchemaAndRecord().getRecord(); |
|
badRecordRouter.route( |
|
outputReceiver, |
|
record, |
|
AvroCoder.of(record.getSchema()), |
|
(Exception) e.getCause(), |
|
"Unable to parse record reading from BigQuery"); |
|
} |
|
} |
|
} |
Related to #20935
Replace with try{i = parse}catch{} if i not null output
beam/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HL7v2IO.java
Lines 365 to 376 in 48139dd
beam/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HL7v2IO.java
Lines 487 to 498 in 3776a99
beam/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java
Lines 602 to 615 in 3776a99
KafkaWriteSchemaTransformProvider
beam/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProvider.java
Lines 150 to 166 in 3776a99
BigQueryIO
beam/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
Lines 2108 to 2141 in 3776a99