Content Manager User Discussions
cancel

Raise TRIM error notification

SOLVED
Go to solution
Respected Contributor.. davros29 Respected Contributor..
Respected Contributor..

Raise TRIM error notification

When TRIM runs into an error (e.g. SQL timeout/error, attempted login by a locked account etc) it sends an error email to the account specified in the Email Notifications tab in the Enterprise Studio options dialog.

Is there a way to raise one of these errors through the SDK? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Respected Contributor.. davros29 Respected Contributor..
Respected Contributor..
Solution

Re: Raise TRIM error notification

Thanks for your suggestions, @rkw, @JanMartin and @David Churchland. I wrote that question quickly and have been away for a while, so apologies for replying to an old thread. 

There's a class called HP.HPTRIM.SDK.TrimException that I thought I might be able to use to kick off one of these emails, but I think I was overthinking it.

The way to do this ended up being embarrassingly simple. I just needed to re-throw the exception in the catch block. So I added throw; and eventually it bubbles up to where it must be handled by TRIM and sends one of these standard error emails. The code is in a Custom Event processor and I just wanted to send an email to the admins if it ran into an issue. I was worried about the event process getting into a "Blocked by error" state but that doesn't seem to happen when it throws an error for a custom processor. Thanks for your help.

4 REPLIES
Micro Focus Expert
Micro Focus Expert

Re: Raise TRIM error notification

I have never seen anything in the SDK to explicitly send one of these emails.

The SDK operates on data stored in the database but the email notification information (as updated in Enterprise Studio) is stored in an XML file on the workgroup server.  I do not see how the SDK could access it.  


Blog | Samples | HPE CM 9.3 SDK Docs
**Any opinions expressed in this forum are my own personal opinion and should not be interpreted as an official statement on behalf of MicroFocus**
Highlighted
JanMartin Outstanding Contributor.
Outstanding Contributor.

Re: Raise TRIM error notification

Are you trying to specifically trigger an existing TRIM error, or do you just want to send your own message?

You could use Email Templates and piggy back off of another event to send your own custom message - have a look at Email Templates to see the events you can trigger emails for.

I've never tried them, but maybe "Alerts" would do what you want?

Contributor.. rkw Contributor..
Contributor..

Re: Raise TRIM error notification

Maybe an overkill - Via the SDK you could extend the TrimEventProcessorAddIn and catch any specific events you wish to handle.

 

public override void ProcessEvent(Database db, TrimEvent evt)
{
switch (evt.EventType)
{
case Events.UserLogoff:
case Events.UserLogon:
case Events.UserLogonFailed:
case Events.NewInstantOnUser:
//Do Something
default:
//Do Something
break;
}
}

Respected Contributor.. davros29 Respected Contributor..
Respected Contributor..
Solution

Re: Raise TRIM error notification

Thanks for your suggestions, @rkw, @JanMartin and @David Churchland. I wrote that question quickly and have been away for a while, so apologies for replying to an old thread. 

There's a class called HP.HPTRIM.SDK.TrimException that I thought I might be able to use to kick off one of these emails, but I think I was overthinking it.

The way to do this ended up being embarrassingly simple. I just needed to re-throw the exception in the catch block. So I added throw; and eventually it bubbles up to where it must be handled by TRIM and sends one of these standard error emails. The code is in a Custom Event processor and I just wanted to send an email to the admins if it ran into an issue. I was worried about the event process getting into a "Blocked by error" state but that doesn't seem to happen when it throws an error for a custom processor. Thanks for your help.

Top Contributors Last 30 Days