Skip to content

NIFI-4479 Added DeleteMongo processor.#2295

Closed
MikeThomsen wants to merge 1 commit intoapache:masterfrom
MikeThomsen:NIFI-4479
Closed

NIFI-4479 Added DeleteMongo processor.#2295
MikeThomsen wants to merge 1 commit intoapache:masterfrom
MikeThomsen:NIFI-4479

Conversation

@MikeThomsen
Copy link
Contributor

@MikeThomsen MikeThomsen commented Nov 25, 2017

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:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

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.

@Override
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
FlowFile flowFile = session.get();
if (flowFile == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@MikeThomsen
Copy link
Contributor Author

Just checked in the updates.

@mattyb149
Copy link
Contributor

+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

@asfgit asfgit closed this in 15eeb22 Dec 15, 2017
@MikeThomsen MikeThomsen deleted the NIFI-4479 branch August 14, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants