|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.props.Props
com.cometway.ak.Agent
com.cometway.ak.ServiceAgent
com.cometway.email.SendEmailAgent
public class SendEmailAgent
This agent queues up email messages and sends them to the smtp_host at regular intervals. There are a variety of properties that can be configured which define how and when these messages are sent. This agent implements the SendEmailInterface and registers with the Service Manager for other agents to use.
| Field Summary | |
|---|---|
protected java.lang.Thread |
emailerThread
|
protected boolean |
isRunning
|
protected java.util.Vector |
messageQueue
|
protected java.lang.Object |
vectorSync
|
| Fields inherited from class com.cometway.ak.Agent |
|---|
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter |
| Constructor Summary | |
|---|---|
SendEmailAgent()
|
|
| Method Summary | |
|---|---|
void |
initProps()
Initializes the Props for this agent: "service_name" is used to register this agent with the Service Manager (default: send_email), "max_queue_size" is the maximum number of messages allocated for storage in the queue (default: 100), "smtp_sleep_ms" is the interval between attempts to send messages in the queue (default: 5000ms), "smtp_host" is the host name or IP address of the SMTP server, "smtp_port" is the port of the SMTP server (default: 25), "smtp_timeout_ms" is the amount of time this agent will wait for a socket connection (default 500ms) |
void |
run()
This method runs on a Thread owned by this agent. |
void |
sendEmailMessage(IMessage m)
Adds an email message to the queue to be sent to the SMTP server. |
void |
start()
Starts this agent by creating the message queue, and the Thread that monitors its contents and sends the messages waiting there, then registers itself with the Service Manager using the "service_name" property. |
void |
stop()
Stops this agent by unregistering itself with the Service Manager, releasing the message queue, and setting appropriate state information to cause the Thread that checks for email in the queue to terminate. |
| Methods inherited from class com.cometway.ak.Agent |
|---|
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Thread emailerThread
protected java.util.Vector messageQueue
protected java.lang.Object vectorSync
protected boolean isRunning
| Constructor Detail |
|---|
public SendEmailAgent()
| Method Detail |
|---|
public void initProps()
initProps in interface AgentInterfaceinitProps in class Agentpublic void start()
start in interface AgentInterfacestart in class ServiceAgentpublic void stop()
stop in interface AgentInterfacestop in class ServiceAgentpublic void sendEmailMessage(IMessage m)
sendEmailMessage in interface SendEmailInterfacepublic void run()
run in interface java.lang.Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||