NIFI-4479 Added DeleteMongo processor.#2295
NIFI-4479 Added DeleteMongo processor.#2295MikeThomsen wants to merge 1 commit intoapache:masterfrom
Conversation
| @Override | ||
| public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException { | ||
| FlowFile flowFile = session.get(); | ||
| if (flowFile == null) { |
There was a problem hiding this comment.
If this requires an incoming flow file then we should add the corresponding InputRequirement annotation. Can you think of a use case where you'd want to execute this without an incoming flow file? Doesn't seem very useful unless there's a flow file present...
| String json = new String(bos.toByteArray()); | ||
| Document query = Document.parse(json); | ||
|
|
||
| getLogger().info("Test\n\n\n\n\n\n"); |
There was a problem hiding this comment.
This can be removed (or replaced with a debug/info message to inform what's going on
| .name("delete-mongo-delete-mode") | ||
| .displayName("Delete Mode") | ||
| .description("Choose between deleting one document by query or many documents by query.") | ||
| .allowableValues(DELETE_ONE, DELETE_MANY) |
There was a problem hiding this comment.
Is this something that the user would want to configure per-flow file? If so, one pattern that is used (to keep the dropdown for allowable values) is to pick an attribute (such as "mongodb.delete.mode") and add an allowable value "Use 'mongodb.delete.mode' attribute"
| .displayName("Delete Mode") | ||
| .description("Choose between deleting one document by query or many documents by query.") | ||
| .allowableValues(DELETE_ONE, DELETE_MANY) | ||
| .defaultValue("one") |
There was a problem hiding this comment.
Should we be displaying the friendly name here?
| private TestRunner runner; | ||
| private MongoClient mongoClient; | ||
| private MongoCollection<Document> collection; | ||
| import static com.google.common.base.Charsets.UTF_8; |
There was a problem hiding this comment.
This doesn't look necessary, and even so we should be using StandardCharsets unless there's some reason not to.
|
|
||
| package org.apache.nifi.processors.mongodb; | ||
|
|
||
| import com.google.common.collect.Lists; |
There was a problem hiding this comment.
Do we already have this library available for some other reason? Wondering why we can't use Arrays.asList(), especially if this is the only use of it (I haven't checked)
8ade06d to
3c1d236
Compare
|
Just checked in the updates. |
|
+1 LGTM, ran a build with unit/integration tests and contrib-check against a live MongoDB, everything works fine. Thanks much for this feature! Merging to master |
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.