com.solab.alarms
Class ProtobufAlarmClient

java.lang.Object
  extended by com.solab.alarms.ProtobufAlarmClient
All Implemented Interfaces:
AlarmSender

public class ProtobufAlarmClient
extends Object
implements AlarmSender

An AlarmSender implementation which connects to a remote AlarmSender using Protocol Buffers.


Constructor Summary
ProtobufAlarmClient(String host, int port)
          Creates a new AlarmSender which will connect to a ProtobufAlarmSender on the specified host and TCP port.
 
Method Summary
 void close()
          Shuts down the alarm queue.
protected  void send(AlarmProtos.Alarm alarm)
          This is the method invoked by interface methods.
 void sendAlarm(String msg)
           
 void sendAlarm(String msg, String source)
           
 void sendAlarmAlways(String msg)
           
 void sendAlarmAlways(String msg, String source)
           
 void setConnectTimeout(int value)
          Sets the connection timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtobufAlarmClient

public ProtobufAlarmClient(String host,
                           int port)
Creates a new AlarmSender which will connect to a ProtobufAlarmSender on the specified host and TCP port.

Method Detail

setConnectTimeout

public void setConnectTimeout(int value)
Sets the connection timeout. Default value is one second; should be set to something low, since the server should be on a local network.


sendAlarm

public void sendAlarm(String msg,
                      String source)
Specified by:
sendAlarm in interface AlarmSender

sendAlarmAlways

public void sendAlarmAlways(String msg,
                            String source)
Specified by:
sendAlarmAlways in interface AlarmSender

sendAlarm

public void sendAlarm(String msg)
Specified by:
sendAlarm in interface AlarmSender

sendAlarmAlways

public void sendAlarmAlways(String msg)
Specified by:
sendAlarmAlways in interface AlarmSender

send

protected void send(AlarmProtos.Alarm alarm)
This is the method invoked by interface methods. Puts the call on a queue.

Parameters:
alarm - An Alarm message compiled from a .proto file.

close

@PreDestroy
public void close()
Shuts down the alarm queue.