tpalfy commented on code in PR #8160:
URL: https://github.com/apache/nifi/pull/8160#discussion_r1465266010


##########
nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/SetSNMP.java:
##########
@@ -101,28 +102,30 @@ public class SetSNMP extends AbstractSNMPProcessor {
     @OnScheduled
     public void init(final ProcessContext context) {
         initSnmpManager(context);
-        snmpHandler = new SetSNMPHandler(snmpResourceHandler);
+        snmpHandler = new SetSNMPHandler(snmpManager);
     }
 
     @Override
     public void onTrigger(final ProcessContext context, final ProcessSession 
processSession) {
         final FlowFile flowFile = processSession.get();
         if (flowFile != null) {
             try {
-                final Optional<SNMPSingleResponse> optionalResponse = 
snmpHandler.set(flowFile.getAttributes());
+                final Target target = 
factory.createTargetInstance(getTargetConfiguration(context, flowFile));
+                final Optional<SNMPSingleResponse> optionalResponse = 
snmpHandler.set(flowFile.getAttributes(), target);
                 if (optionalResponse.isPresent()) {
                     processSession.remove(flowFile);
                     final FlowFile outgoingFlowFile = processSession.create();
                     final SNMPSingleResponse response = optionalResponse.get();
-                    
processSession.getProvenanceReporter().receive(outgoingFlowFile, "/set");
-                    handleResponse(context, processSession, outgoingFlowFile, 
response, REL_SUCCESS, REL_FAILURE, "/set");
+                    handleResponse(context, processSession, outgoingFlowFile, 
response, REL_SUCCESS, REL_FAILURE, "/set", true);
                 } else {
                     getLogger().warn("No SNMP specific attributes found in 
flowfile.");
                     processSession.transfer(flowFile, REL_FAILURE);
+                    processSession.getProvenanceReporter().receive(flowFile, 
"/set");
                 }
             } catch (IOException e) {
                 getLogger().error("Failed to send request to the agent. Check 
if the agent supports the used version.");
                 processSession.transfer(processSession.penalize(flowFile), 
REL_FAILURE);
+                processSession.getProvenanceReporter().receive(flowFile, 
"/set");

Review Comment:
   ```suggestion
   ```



##########
nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/SetSNMP.java:
##########
@@ -101,28 +102,30 @@ public class SetSNMP extends AbstractSNMPProcessor {
     @OnScheduled
     public void init(final ProcessContext context) {
         initSnmpManager(context);
-        snmpHandler = new SetSNMPHandler(snmpResourceHandler);
+        snmpHandler = new SetSNMPHandler(snmpManager);
     }
 
     @Override
     public void onTrigger(final ProcessContext context, final ProcessSession 
processSession) {
         final FlowFile flowFile = processSession.get();
         if (flowFile != null) {
             try {
-                final Optional<SNMPSingleResponse> optionalResponse = 
snmpHandler.set(flowFile.getAttributes());
+                final Target target = 
factory.createTargetInstance(getTargetConfiguration(context, flowFile));
+                final Optional<SNMPSingleResponse> optionalResponse = 
snmpHandler.set(flowFile.getAttributes(), target);
                 if (optionalResponse.isPresent()) {
                     processSession.remove(flowFile);
                     final FlowFile outgoingFlowFile = processSession.create();
                     final SNMPSingleResponse response = optionalResponse.get();
-                    
processSession.getProvenanceReporter().receive(outgoingFlowFile, "/set");
-                    handleResponse(context, processSession, outgoingFlowFile, 
response, REL_SUCCESS, REL_FAILURE, "/set");
+                    handleResponse(context, processSession, outgoingFlowFile, 
response, REL_SUCCESS, REL_FAILURE, "/set", true);
                 } else {
                     getLogger().warn("No SNMP specific attributes found in 
flowfile.");
                     processSession.transfer(flowFile, REL_FAILURE);
+                    processSession.getProvenanceReporter().receive(flowFile, 
"/set");

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to