NIFI-7195 - Catch MongoException to route flow files to failure

This closes #4089

Signed-off-by: Mike Thomsen <mthomsen@apache.org>
This commit is contained in:
Pierre Villard 2020-02-25 14:00:31 -08:00 committed by Mike Thomsen
parent ac4d52b6ca
commit 0f775f3a57
No known key found for this signature in database
GPG Key ID: 88511C3D4CAD246F
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@
*/
package org.apache.nifi.processors.mongodb;
import com.mongodb.MongoException;
import com.mongodb.WriteConcern;
import com.mongodb.client.MongoCollection;
import org.apache.nifi.annotation.behavior.EventDriven;
@ -144,7 +145,7 @@ public class PutMongoRecord extends AbstractMongoProcessor {
if (inserts.size() > 0) {
collection.insertMany(inserts);
}
} catch (SchemaNotFoundException | IOException | MalformedRecordException e) {
} catch (SchemaNotFoundException | IOException | MalformedRecordException | MongoException e) {
getLogger().error("PutMongoRecord failed with error:", e);
session.transfer(flowFile, REL_FAILURE);
error = true;