[resolved] How to get tSendMail to mail output of tLogRow?

One Star

[resolved] How to get tSendMail to mail output of tLogRow?

I have a job that pulls data from one database, does some reformating then calls a web service to insert the data into a different database. In other words, a fairly typical ETL job. I would like to email two logs to an admin. One log comes from the tWebServiceInput that calls the web service to add the data. The tWebServiceInput connects to a tLogRow to collect the results and that works fine. The second log is generated by a tLogCatcher for the exceptions and errors. It also connects to a tLogRow. The 2 tLogRows each connect to a tSendMail.
The problem: is there is an easy way in tSendMail to effectively say, mail the stuff that the tLogRow is sending you?
Many Thanks.

Accepted Solutions
Community Manager

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi
You can store the result to context variables or global variables first, and then get its value on tSendMail component, for example:
...other subjobs...
|
onsubjobok
|
tWebServiceInput--main--tJavaRow_1
|
tSendMail_1
tLogCatcher--main--tJavaRow_2
|
onsubjobok
|
tSendMail_2
on tJavaRow_1, store the result returned by the web service into a global variable.
globalMap.put("key1", input_row.result);
//result is the column name.
on tSendMail_1, define the message as below:
"Hello admin, this is the result returned by the web service "+(String)globalMap.get("key1")
Using the same way to handle the log captured by tLogCapture.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi
What do you mean 'effectively'?
You just want to use one tSendMail? Or you want to delete all tLogRow?
Use tFileOutputDelimited to generate two log files and attach them in tSendMail.
Regards,
Pedro
Community Manager

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi
You can store the result to context variables or global variables first, and then get its value on tSendMail component, for example:
...other subjobs...
|
onsubjobok
|
tWebServiceInput--main--tJavaRow_1
|
tSendMail_1
tLogCatcher--main--tJavaRow_2
|
onsubjobok
|
tSendMail_2
on tJavaRow_1, store the result returned by the web service into a global variable.
globalMap.put("key1", input_row.result);
//result is the column name.
on tSendMail_1, define the message as below:
"Hello admin, this is the result returned by the web service "+(String)globalMap.get("key1")
Using the same way to handle the log captured by tLogCapture.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

OK, I've taken the suggestions and they work just fine.
A followup question: I think I've read all the documentation, but I didn't see any place this kind of job design issue is discussed, analyzed or solutions suggested. Is there some document that I missed? Or is the best way to proceed to simply to post questions here (after searching the forum for existing solutions, of course)? How does a new Talend developer learn this?
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi
If you have read all tutorials and download , for special requirements or questions you might post new topic at Talend Community here where people shares experience, scenarios and advanced instructions.
Besides, Talend are building a knowledge base for troubleshooting and users guides.
It will come soon.
Regards,
Pedro
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi,
I was designing a similar package.I have a issue
tLogCatcher--main-->tLogRow--main-->tJavaRow
|
onsubjobok
|
tSendMail
Here tJavaRow is used to build the message of the mail.
I used this flow but it sends 2 mails instead of one if there are multiple(2) errors.I need only only mail to come to my inbox irrespective of number of errors with all the error messages.

I guess this is happening because tLogCatcher gets called whenever there is a error and not at the end to log all errors.Do we have any workaround for this ??
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

I am having the same issue, can anyone help pls, getting multiple mail to my inbox, i need only one mail to the inbox, what to do??
One Star

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi,
I have a similar issue.I want the content of tlogRow to be pushed via an email.To be more clear my data is dynamic (can be 2 or 3 or 4 rows) .I need to send this in a form of a table through the body of an  email without any attachments. tlogrow is printing content as required.Would like to know if the same content can be pushed via an email
Community Manager

Re: [resolved] How to get tSendMail to mail output of tLogRow?

Hi,
I have a similar issue.I want the content of tlogRow to be pushed via an email.To be more clear my data is dynamic (can be 2 or 3 or 4 rows) .I need to send this in a form of a table through the body of an  email without any attachments. tlogrow is printing content as required.Would like to know if the same content can be pushed via an email

This topic was very old and it has many replies. In order to better follow up your question, can you please open a new topic for your problem.
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business