Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Default on Error - Hook should send a mail

158 views
Skip to first unread message

Christoph Hölscher

unread,
Jan 19, 2009, 8:52:41 AM1/19/09
to
Hi,
I found the Function-Component "SendEmailFC".
It works fine, that it sends E-Mails when data is changed with a
Assamble-Line.
But one thing, it couln´t solve on my own:

I would realise to get an E-Mail, wenn the Assamble-Line doesnt work.
I tried to realise this by using the hook "Default on Error", but found no
way to do so.
Is something like that possible?

Best wishes

Christoph


Eddie Hartman

unread,
Jan 20, 2009, 4:13:28 AM1/20/09
to
Hi Christoph,

You have a couple of options here:

1). Have a configured SendEmail FC in your Assemblyline, called
for example "SendMail". and then from your Error Hook you
invoke it:

var mailEntry = system.newEntry();
mailEntry.setAttribute("body", "Error in [" + task.getShortName()
+ "/" +
error.getString("connectorname")
+ "] during " +
error.getString("operation"));
mailEntry.setAttribute("subject", "Error mail from TDI: " +
error.getString("Message"));

// other param values you can override with Output Mapped
Attributes:
// attachments, from, recipients, smtpServerHost,
smtpServerPort

SendMail.perform(mailEntry);

2). Or you use the system.sendMail() method. Just look it
up in the JavaDocs (Help > Low Level API) under the class
named "UserFunctions"

-Eddie

On Jan 19, 2:52 pm, "Christoph Hölscher" <ch.hoelsc...@googlemail.com>
wrote:

Christian Chateauvieux

unread,
Jan 22, 2009, 5:51:36 PM1/22/09
to
Christoph,

I saw Eddie's answer... as he advices, you can use a passive component
by invoking it via scripting... or use the sendMail method... but you
could also simply set a variable or work entry attribute in the error
hook and use a branch (named IF_ERROR for instance) to send the email
(see
http://www.tdi-users.org/twiki/pub/Integrator/LearningTDI/03Branches_and_AttMap_Components.wmv)
The later approach would make your AL slightly more "visual"...

HTH,

Christian

Eddie Hartman

unread,
Jan 23, 2009, 4:00:57 AM1/23/09
to
Here I am usually advocating "visible logic" in the
AL thru Branches, Loops and SCs rather than Hook
coding (when possible), and then I go off and recommend
doing this in a Hook.

Thanks, Christian :)

-Eddie

On Jan 22, 11:51 pm, Christian Chateauvieux


<christian.chateauvi...@fr.ibm.com> wrote:
> Christoph,
>
> I saw Eddie's answer... as he advices, you can use a passive component
> by invoking it via scripting... or use the sendMail method... but you
> could also simply set a variable or work entry attribute in the error
> hook and use a branch (named IF_ERROR for instance) to send the email

> (seehttp://www.tdi-users.org/twiki/pub/Integrator/LearningTDI/03Branches_...)

0 new messages