How to get console contents into tSendMail email message content?

One Star

How to get console contents into tSendMail email message content?

Hi, as per title, I'd like to see what my console prints out in the email message content
My canvas image is attached
What do I need to put in the Message field in order to achieve this?
I've tried various selections from the ctrl spacebar dropdown list (without editing any of them) as per this page https://help.talend.com/search/all?query=tSendMail
For example, I have tried putting:
((String)globalMap.get("tMysqlOutput_1_ERROR_MESSAGE"))

In the Message field
My incoming email message content is
""

Thank You Smiley Happy
Seventeen Stars

Re: How to get console contents into tSendMail email message content?

This design cannot work. If you get a reject flow no error messages will be put into the globalMap.
The reject flow contains in two additional columns the message and the exception why this dataset is rejected.
You should use these informations!
One Star

Re: How to get console contents into tSendMail email message content?

Hi, what design would you recommend to capture errors and email their contents in this case?
Thank You
Seventeen Stars

Re: How to get console contents into tSendMail email message content?

I would store the rejected datasets (including the additional errorMessage) into a file.
In a new subjob I would check the counter tDBOutput_REJECTS and if it not null and greater than 0 I would send an email with the created file as attachment.
One Star

Re: How to get console contents into tSendMail email message content?

Thanks for sharing; sounds rather different from what I'm currently doing here
Seventeen Stars

Re: How to get console contents into tSendMail email message content?

Yes it is different but I am confident it is more stable and maintainable.
Community Manager

Re: How to get console contents into tSendMail email message content?

Hi
You can also consider to use a custom component called tRedirectOutput to redirect the entire message printed on the console to a text file, and send an email with the file if the job run fails, the job design looks like:
tMysqlInput--main--tMap--tMysqlOutput
|
onsubjoberror
|
tSendmail
About tRedirectOutput component, please read this topic:
http://www.talendforge.org/forum/viewtopic.php?pid=108078#p108078
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to get console contents into tSendMail email message content?

Hello, and thank You for your reply Smiley Happy
tRedirectOutput is omitted from your job design example; how does it fit in to your above design recommendation?
One Star

Re: How to get console contents into tSendMail email message content?

Hi Shong, still interested to know how tRedirectOutput fits into your recommended design
Thanks Smiley Happy
Community Manager

Re: How to get console contents into tSendMail email message content?

Hi
The job is designed as below:
tPreJob--oncomponentOK--->tRedirectOutput
tMysqlInput--main--tMap--tMysqlOutput
|
onsubjoberror
|
tSendmail
Let me know if you have any questions.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business