You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by jvwing <gi...@git.apache.org> on 2017/06/03 22:15:08 UTC

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

GitHub user jvwing opened a pull request:

    https://github.com/apache/nifi/pull/1888

    NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

    * Avoid exception by providing id in DeleteMessageBatchRequestEntry
    * Include receipt handle property descriptor for user configuration
    
    ----
    
    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:
    - [X] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [X] 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.
    
    - [X] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [X] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [X] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [X] 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](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] 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?
    - [X] 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.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jvwing/nifi NIFI-4015-deletesqs-fix-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/1888.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1888
    
----
commit 6e437a5a7fa7bae9c90d17861a2c931841c67b50
Author: James Wing <jv...@gmail.com>
Date:   2017-06-03T19:49:08Z

    NIFI-4015 NIFI-3999 Fix DeleteSQS Issues
    
    * Avoid exception by providing id in DeleteMessageBatchRequestEntry
    * Include receipt handle property descriptor for user configuration

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by brosander <gi...@git.apache.org>.
Github user brosander commented on the issue:

    https://github.com/apache/nifi/pull/1888
  
    Reviewing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jvwing <gi...@git.apache.org>.
Github user jvwing commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1888#discussion_r130516693
  
    --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/sqs/ITDeleteSQS.java ---
    @@ -0,0 +1,83 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.aws.sqs;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +import com.amazonaws.regions.Regions;
    +import com.amazonaws.services.sqs.model.Message;
    +import com.amazonaws.services.sqs.model.ReceiveMessageResult;
    +import com.amazonaws.services.sqs.model.SendMessageResult;
    +import org.apache.nifi.util.TestRunner;
    +import org.apache.nifi.util.TestRunners;
    +
    +import com.amazonaws.auth.PropertiesCredentials;
    +import com.amazonaws.services.sqs.AmazonSQSClient;
    +
    +import org.junit.Before;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +
    +@Ignore("For local testing only - interacts with S3 so the credentials file must be configured and all necessary queues created")
    +public class ITDeleteSQS {
    +
    +    private final String CREDENTIALS_FILE = System.getProperty("user.home") + "/aws-credentials.properties";
    --- End diff --
    
    @jzonthemtn The DeleteSQS processor can absolutely use default credentials through a controller service.  The integration tests across the SQS processors and most of the AWS bundle use a properties file, and I followed that pattern.  I'm not sure if it was desired as the best solution, or just the one we knew how to use at the time.  Maybe it prevents people from accidentally running the integration tests on with their default credentials?
    
    What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jvwing <gi...@git.apache.org>.
Github user jvwing commented on the issue:

    https://github.com/apache/nifi/pull/1888
  
    Thanks, @pvillard31 


---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jzonthemtn <gi...@git.apache.org>.
Github user jzonthemtn commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1888#discussion_r130491355
  
    --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/sqs/ITDeleteSQS.java ---
    @@ -0,0 +1,83 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.aws.sqs;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +import com.amazonaws.regions.Regions;
    +import com.amazonaws.services.sqs.model.Message;
    +import com.amazonaws.services.sqs.model.ReceiveMessageResult;
    +import com.amazonaws.services.sqs.model.SendMessageResult;
    +import org.apache.nifi.util.TestRunner;
    +import org.apache.nifi.util.TestRunners;
    +
    +import com.amazonaws.auth.PropertiesCredentials;
    +import com.amazonaws.services.sqs.AmazonSQSClient;
    +
    +import org.junit.Before;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +
    +@Ignore("For local testing only - interacts with S3 so the credentials file must be configured and all necessary queues created")
    +public class ITDeleteSQS {
    +
    +    private final String CREDENTIALS_FILE = System.getProperty("user.home") + "/aws-credentials.properties";
    --- End diff --
    
    Can it use the default credential provider chain in case there is no properties file?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jvwing <gi...@git.apache.org>.
Github user jvwing commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1888#discussion_r124175675
  
    --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/sqs/DeleteSQS.java ---
    @@ -45,7 +46,8 @@
     public class DeleteSQS extends AbstractSQSProcessor {
     
         public static final PropertyDescriptor RECEIPT_HANDLE = new PropertyDescriptor.Builder()
    -            .name("Receipt Handle")
    +            .name("sqs-receipt-handle")
    --- End diff --
    
    Thanks for reviewing, @brosander.
    
    Ordinarily, I would agree that changing the name is bad, but I don't believe that is the case here.  The `RECEIPT_HANDLE` property descriptor is not actually added to the current list of property descriptors on the processor.  The diffs for lines 57-60 don't make it crystal clear, but the problem is that the processor uses this property descriptor without ever actually declaring it for the user to configure.  It works by coasting on the default value expression.  Since it has never been added to a DeleteSQS processor in an as-is version of NiFi, I don't believe we have the upgrade problem you expect.
    
    I'm certainly not attached to changing the name, I just thought it would be a good practice under the circumstances.  I would be happy to take that out if you aren't convinced.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jzonthemtn <gi...@git.apache.org>.
Github user jzonthemtn commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1888#discussion_r130582495
  
    --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/sqs/ITDeleteSQS.java ---
    @@ -0,0 +1,83 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.aws.sqs;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +import com.amazonaws.regions.Regions;
    +import com.amazonaws.services.sqs.model.Message;
    +import com.amazonaws.services.sqs.model.ReceiveMessageResult;
    +import com.amazonaws.services.sqs.model.SendMessageResult;
    +import org.apache.nifi.util.TestRunner;
    +import org.apache.nifi.util.TestRunners;
    +
    +import com.amazonaws.auth.PropertiesCredentials;
    +import com.amazonaws.services.sqs.AmazonSQSClient;
    +
    +import org.junit.Before;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +
    +@Ignore("For local testing only - interacts with S3 so the credentials file must be configured and all necessary queues created")
    +public class ITDeleteSQS {
    +
    +    private final String CREDENTIALS_FILE = System.getProperty("user.home") + "/aws-credentials.properties";
    --- End diff --
    
    I think it's fine as is after reading your comment. I didn't realize most of the integration tests use a properties file. No reason to break from that norm in this case. That's a good point about requiring separate credentials to prevent anything unintended from happening.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by brosander <gi...@git.apache.org>.
Github user brosander commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1888#discussion_r124067647
  
    --- Diff: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/sqs/DeleteSQS.java ---
    @@ -45,7 +46,8 @@
     public class DeleteSQS extends AbstractSQSProcessor {
     
         public static final PropertyDescriptor RECEIPT_HANDLE = new PropertyDescriptor.Builder()
    -            .name("Receipt Handle")
    +            .name("sqs-receipt-handle")
    --- End diff --
    
    @jvwing 
    
    I think changing the name attribute at this point will break existing flows.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by chimbosonic <gi...@git.apache.org>.
Github user chimbosonic commented on the issue:

    https://github.com/apache/nifi/pull/1888
  
    Hi has this been fixed?
    I am getting this error on 1.6.0
    ```
    DeleteSQS[id=68fc36fd-0163-1000-caa3-b18f1a8a3273] Failed to delete 1 objects from SQS due to There should be at least one DeleteMessageBatchRequestEntry in the request. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.EmptyBatchRequest; Request ID: f575689e-2d93-5592-9770-3be81ab4e548): com.amazonaws.services.sqs.model.EmptyBatchRequestException: There should be at least one DeleteMessageBatchRequestEntry in the request. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.EmptyBatchRequest; Request ID: f575689e-2d93-5592-9770-3be81ab4e548)
    ```


---

[GitHub] nifi issue #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/1888
  
    Hi @chimbosonic - thanks for jumping here, this PR should definitely be merged. We just forgot about it. I'll give it a try today and get it merged. In the meantime, feel free to checkout the fix and build the AWS NAR to solve your issue.


---

[GitHub] nifi pull request #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/1888


---

[GitHub] nifi issue #1888: NIFI-4015 NIFI-3999 Fix DeleteSQS Issues

Posted by jvwing <gi...@git.apache.org>.
Github user jvwing commented on the issue:

    https://github.com/apache/nifi/pull/1888
  
    @brosander I added an update to keep the existing attribute name.  Please let me know if/when we need a squash and rebase.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---