All Examples This Package
package examples.event.stocks
EvaluateStocks
MailStockInfo
Register
SendEvents
about this package
This package contains a small stock-price application that is driven by
WebLogic Events. There are four Java files:
- Register lets you register interest in events having to do with
certain stocks. You run this class from a command-line prompt.
- SendEvents generates events for certain stocks. After you register,
you run this from a second command-line prompt to generate event traffic.
- EvaluateStocks is the evaluator class that Register uses in its
EventRegistration. It evaluates whether WebLogic should call the action
class for each related event.
- MailStockInfo is the action class that Register uses in its
EventRegistration. It sends you email when your registered stock
gets to a certain price range.
how to use this package
- Set up your development environment as describe in
Setting your development environment.
- Compile the EvaluateStocks.java and MailStockInfo.java classes to your
SERVER_CLASSES directory, with a command like this one for Windows NT:
$ javac -d %SERVER_CLASSES% EvaluateStocks.java MailStockInfo.java
- Compile the Register.java and
SendEvents.java classes to your
CLIENT_CLASSES directory
with a command like this one for Windows NT:
$ javac -d %CLIENT_CLASSES% Register.java SendEvents.java
- Start WebLogic Server in your server shell.
- Register an interest in some stocks by calling the Register class
from a development shell. (Use a real email account -- your own -- and
supply a valid SMTP server.) Here's an example that registers an
interest in Sun Microsystems stock at $75 share for an interested
party foo@bar.com, using the SMTP server at bigisp.com:
$ java examples.event.stocks.Register t3://localhost:7001 SUNW 75 smtp.bigisp.com foo@bar.com
- Generate some stock traffic by calling the SendEvents class
from your development shell. Here's an example that generates
matching traffic for the registration above, with a series of
prices that start at 105 and fall to 70:
$ java examples.event.stocks.SendEvents t3://localhost:7001 SUNW 70 105
- Check your email.
there's more . . .
Check out the Developers Guide
Using WebLogic Events
for more about writing event-driven applications.