public class TwitterChannel extends AbstractAlarmChannel
log| Constructor and Description |
|---|
TwitterChannel() |
| Modifier and Type | Method and Description |
|---|---|
protected Runnable |
createSendTask(String msg,
String src)
Subclasses need to create and return a new Runnable in each call to this method.
|
String |
getApiUrl() |
protected boolean |
hasSource(String alarmSource)
This method is used to determine if a certain alarm channel has a special condition for the specified
alarmSource or not.
|
void |
init()
Initializes the component.
|
void |
setAccessToken(String value)
Sets the access token obtained with the TwitterAuth program; this allows jAlarms to post
status updates to the twitter account set up for the alarms.
|
void |
setAlarmSource(Set<String> value)
You can set a list of sources in this property so that only alarm messages matching any of the sources
are be posted as status updates.
|
void |
setApiUrl(String value)
Sets the Twitter API URL to update the user's status.
|
void |
setConnectTimeout(int value)
Sets the connection timeout, in milliseconds.
|
void |
setPrefix(String value)
This is an optional property; you can set a prefix to be used in all the status updates;
this is useful in cases where you need to use the same Twitter account for more than one
application, so you can tell which one sent the alarm.
|
void |
setReadTimeout(int value)
Sets the timeout to wait for a response, in milliseconds.
|
void |
setTokenSecret(String value)
Sets the token secret obtained with the TwitterAuth program; this allows jAlarms to post
status updates to the twitter account set up for the alarms.
|
getMinResendInterval, send, setAllowSynchronousSend, setMinResendInterval, shutdownpublic void setApiUrl(String value) throws MalformedURLException
MalformedURLExceptionpublic String getApiUrl()
public void setPrefix(String value)
public void setAlarmSource(Set<String> value)
public void setConnectTimeout(int value)
public void setReadTimeout(int value)
public void setAccessToken(String value)
public void setTokenSecret(String value)
@PostConstruct public void init() throws NoSuchAlgorithmException, MalformedURLException
NoSuchAlgorithmException - if the HmacSHA1 algorithm is not available.MalformedURLExceptionprotected Runnable createSendTask(String msg, String src)
AbstractAlarmChannelcreateSendTask in class AbstractAlarmChannelmsg - The message to be sent.src - The alarm source. A channel can have different recipient lists depending on the alarm source.protected boolean hasSource(String alarmSource)
AbstractAlarmChannelhasSource in class AbstractAlarmChannel