Help with Flowfile Content to Attribute

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with Flowfile Content to Attribute

davidrsmith
Hi
I have a scenario where I have a flowfile which is come in and I want to email the contents to a recipient. I am currently using the putSmtp processor which works fine except that I have to email the flowfile as an attachment, so when the recipient gets the email they have to open an attachment. It would be nice to allow them to read it as a normal email body. The putSmtp processor has a property descriptor which will allow a flowfile attribute to be used as the body of the email.
So what I would like to do is, if the flowfile is less than a certain size (for arguments sake 2.5K) then I would like to make the flowfile into an attribute to use in the property Descriptor, otherwise  I am happy to send it as an attachment. 
Does anyone have any ideas on how after I have routed on filesize I can make my flowfile into an attribute preferably using standard processors, I am using NiFi 0.7.1?
Many thanksDave
Reply | Threaded
Open this post in threaded view
|

Re: Help with Flowfile Content to Attribute

Joe Witt
Dave,

If your attachment is simply text I think you could use 'ExtractText'
to grab the whole body of the content as an attribute.

Thanks

On Tue, Jun 6, 2017 at 3:05 PM, DAVID SMITH <[hidden email]> wrote:
> Hi
> I have a scenario where I have a flowfile which is come in and I want to email the contents to a recipient. I am currently using the putSmtp processor which works fine except that I have to email the flowfile as an attachment, so when the recipient gets the email they have to open an attachment. It would be nice to allow them to read it as a normal email body. The putSmtp processor has a property descriptor which will allow a flowfile attribute to be used as the body of the email.
> So what I would like to do is, if the flowfile is less than a certain size (for arguments sake 2.5K) then I would like to make the flowfile into an attribute to use in the property Descriptor, otherwise  I am happy to send it as an attachment.
> Does anyone have any ideas on how after I have routed on filesize I can make my flowfile into an attribute preferably using standard processors, I am using NiFi 0.7.1?
> Many thanksDave
Reply | Threaded
Open this post in threaded view
|

Re: Help with Flowfile Content to Attribute

Matt Burgess
In reply to this post by davidrsmith
Dave,

You should be able to use ExtractText to match the entire content and put it in an attribute.

Regards,
Matt

> On Jun 6, 2017, at 3:05 PM, DAVID SMITH <[hidden email]> wrote:
>
> Hi
> I have a scenario where I have a flowfile which is come in and I want to email the contents to a recipient. I am currently using the putSmtp processor which works fine except that I have to email the flowfile as an attachment, so when the recipient gets the email they have to open an attachment. It would be nice to allow them to read it as a normal email body. The putSmtp processor has a property descriptor which will allow a flowfile attribute to be used as the body of the email.
> So what I would like to do is, if the flowfile is less than a certain size (for arguments sake 2.5K) then I would like to make the flowfile into an attribute to use in the property Descriptor, otherwise  I am happy to send it as an attachment.
> Does anyone have any ideas on how after I have routed on filesize I can make my flowfile into an attribute preferably using standard processors, I am using NiFi 0.7.1?
> Many thanksDave