Experts,  
  
I have figured out how to CHANGE a flowfile's attributes (make a new one), but
not how to ADD to it new attributes. My tinkering is at this level currently:

  

**@Override  
public void onTrigger(final ProcessContext context, final ProcessSession
session) throws ProcessException {  
FlowFile flowFileBefore = session.get();  
if ( flowFileBefore == null ) {  
    return;  
}  
// TODO implement  
//  
System.out.println("Received a flow file"); // I never see this... Where to
look?  
// String p = flowFile.getAttribute(MY_PROPERTY.getName()); // "My Property"**

**  
**

**

// This works, as long as I only change an existing (input) attribute...

// FlowFile flowFileAfter = session.putAttribute(flowFileBefore,"My Property",
"foo!");  

  

// I need to build a _complete_ descriptor, I'm thinking? (see below after
this method)

Map<String, String> mAfter = ListToMap(descriptors);  
mAfter.put("Third name", "Third Description"); // <\--- doesn't make Nifi
happy!  
//  
FlowFile flowFileAfter = session.putAllAttributes(flowFileBefore, mAfter);  
session.transfer(flowFileAfter, MY_RELATIONSHIP);  
}**

**  
**

_Creating a descriptor (Attribute):_

**  
**

public static final PropertyDescriptor MY_PROPERTY2 = new PropertyDescriptor  
.Builder().name("My Property2")  
.description("Example Property2")  
.required(false)  
.build();**  
**

**  
**

It must be really simple, but even with me being simple, I'm just staring at
forum posts...

  

TIA!

  

Thanks!  
  

[pat](http://about.me/PatTrainor)  

( ͡° ͜ʖ ͡°)  

  

Reply via email to