I'm trying to glue two flow files together HORIZONTALLY. That is,
Flowfile1
ID,STARTINGLETTER
1,A
2,B
And flowfile2:
ID, WORD
1,Apple
2, Ball
3, Cat
I want it to become:
ID, STARTINGLETTER, WORD
1,A,Apple
2,B,Ball
3,,Cat
The only way I've been able to figure out how to do this is to write a custom
"InvokeGroovyProcessor" that takes two flowfiles reads them both, and then
concatenates them.
I'm having trouble figuring out how to pop TWO flow files off the queue, (The
order doesn't really matter for now), and write one. I've tried
@Override
void onTrigger(ProcessContext context, ProcessSessionFactory
sessionFactory) throws ProcessException {
try {
def session = sessionFactory.createSession()
while (session.getQueueSize() != 2)
{
Thread.sleep(1000)
log.debug("sleeping")
}
// we never get here
log.debug("found two flow files")
// get BOTH flowfiles
def flowFileList = session.get(2)
def flowFile1 = flowFileList.get(0)
def flowFile2 = flowFileList.get(1)
// now do the glue
Or Is there a better way?
Thanks!
Geoffrey Greene
Senior Software Ninjaneer
(703) 414 2421
The Boeing Company