public class AlertReceiver extends Object
Sample Test program
...
public void onAlertRecieved(AlertMessageInfo alertMsg) {
//implement callback logic
...
}
...
public void method check {
AlertReceiver receiver = null;
...
try {
receiver = new AlertReceiver(callback, portnum);
receiver.beginReceive(serverContext);
} catch (ARException e) {
//do logging etc
} finally {
//when done close the receiver
receiver.close();
}
}
...
| Constructor and Description |
|---|
AlertReceiver(AlertCallbackHandler callbackHandler)
Constructs an AlertReceiver.
|
AlertReceiver(AlertCallbackHandler callbackHandler,
int port)
Constructs an AlertReceiver.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
beginReceive(ARServerUser context)
Begin receiving alert messages for the user from a particular ARServer
specified by the context.
|
void |
close()
Close the server socket and stop the thread started to listen on the server socket.
|
void |
stopReceive(ARServerUser context)
Stop receiving alert messages for the user from a particular ARServer
specified by the context.
|
public AlertReceiver(AlertCallbackHandler callbackHandler) throws IOException
callbackHandler - IOExceptionpublic AlertReceiver(AlertCallbackHandler callbackHandler, int port) throws IOException
callbackHandler - handler that will be invoked upon receiving alertsport - the port number, or 0 to use any free port.IOException - if an I/O error occurs when opening the socketpublic boolean beginReceive(ARServerUser context) throws ARException
context - specifies the user and AR Server to start receiving alertsARException - if invalid loginpublic void stopReceive(ARServerUser context) throws ARException
context - specifies the user and AR Server to stop receiving alertsARException - if invalid loginpublic void close()
throws IOException
IOException - if an I/O error occurs when closing the socket.? Copyright 2013 BMC Software, Inc.