Collapse All Expand All

.NET Framework Class Library
See Also

[TIBCO.EMS .NET client library 5.1 documentation]

Delegate declaration for exception handler

Namespace: TIBCO.EMS
Assembly: TIBCO.EMS (in TIBCO.EMS.dll)

# Syntax

    public delegate void EMSExceptionHandler(
    	Object sender,
    	EMSExceptionEventArgs args
    )

    Public Delegate Sub EMSExceptionHandler ( _
    	sender As Object, _
    	args As EMSExceptionEventArgs _
    )

    public delegate void EMSExceptionHandler(
    	Object^ sender,
    	EMSExceptionEventArgs^ args
    )

#### Parameters

sender
  Type: System..::.Object
  The source of the event, the Connection object in this case.

args
  Type: TIBCO.EMS..::.EMSExceptionEventArgs
  The event argument, EMSExceptionEventArgs, that contains the exception object.

# Remarks

Asynchronously detect problems with connections.

When a program uses a connection to send messages, the send calls can detect problems with the connection, and notify the client program by throwing exceptions. However, when a program uses a connection only to receive messages, the client cannot catch such exceptions.

This delegate provides an alternate pathway for alerting a client program of connection problems. The program implements this delegate, and registers it with the connection. When the client library detects a connection problem, it raises an event. This delegate processes the event, which contains an exception that details the problem.

EMSExceptionHandler detects this type of problem in a .NET programming idiom. In contrast, IExceptionListener mimics the way in which JMS provides similar functionality in a Java programming idiom. Programmers may select either idiom—but not both (which would cause duplicate exception processing, with undefined behavior).

Exception Event Handler Example:

| Copy Code
--- | ---
                ...
                connection.ExceptionHandler += new EMSExceptionHandler(handleEx);
                ...
                private void handleEx(object sender, EMSExceptionEventArgs arg)
                {
                   EMSException e = arg.Exception;
                   Console.WriteLine("Exception: " + e.Message);
                }
                ...

# See Also

TIBCO.EMS Namespace