• No results found

Stock example

In document IBM WebSphere Everyplace Access V5 (Page 57-66)

Chapter 1. Intelligent Notification Services

1.6 Scenarios

1.6.1 Stock example

This scenario sends notifications to a user named Christian about stocks when those stocks have reached a specific limit. The user has specified three delivery channels: e-mail, BlackBerry, and the Message Center.

The stock price is simulated by the sample stock feed application, which is part of the Intelligent Notification Services. The stock price information is stored in an XML file. The application reads this file and sends the data to the Subscription Manager.

If the stock price is less than $50, a notification message is sent to the Message Center. If the stock price is higher than $100, a notification message is sent to all three delivery channels.

First, we configure the delivery channels as necessary (for example, supplying which e-mail address or BlackBerry PIN should be used). After that, we configure the stock subscription by specifying which stock should be monitored and at which price the user should be informed. Finally, we configure the sample stock feed application to send the stock information to the Subscription Manager.

Configuring delivery channels

1. Log in to the WebSphere Everyplace Access portal as user Christian.

2. Select Intelligent Notification Setup My Delivery Channels. The screen shown in Figure 1-26 appears.

Figure 1-26 Add a new e-mail delivery channel

3. Click Add delivery channel. The window shown in Figure 1-27 on page 42 appears.

4. Enter the name of this channel. This name is used later to specify which notification should be sent to which delivery channel. We use e-mail in this scenario.

5. Specify an e-mail address to where the notification should sent.

Figure 1-27 Configure e-mail delivery channel

6. Click OK.

After the e-mail delivery channel is configured, we configure the BlackBerry delivery channel.

1. Select Intelligent Notification Setup My Delivery Channels. The screen shown in Figure 1-28 appears.

Figure 1-28 Add a new BlackBerry delivery channel

2. Click Add delivery channel. The window shown in Figure 1-29 on page 43 appears.

4. Specify the PIN of your device.

Figure 1-29 Configure BlackBerry delivery channel

Configuring the subscriptions

To configure the subscriptions for this scenario:

1. Logged in as Christian in the WebSphere Everyplace Access portal, go to

Intelligent Notification Setup My Subscriptions. The screen shown in Figure 1-30 appears.

2. Click New. The window in Figure 1-31 appears. 3. Enter the following information:

– Enter CK as the stock symbol.

– Select Less than and enter 50 in the stock price (points).

– Select Always to receive a notification every time the stock price is less than 50.

– Select All of the selected delivery channels and Default as delivery channel.

4. Click OK.

5. Click New. The window in Figure 1-32 appears. 6. Enter the following information:

– Enter CK as stock symbol.

– Select Higher than and enter 100 in the stock price (points).

– Select Always to receive a notification every time the stock price is higher than 100.

– Select All of the selected delivery channels and default, e-mail, and

BlackBerry as delivery channels.

7. Click OK. You should see two cases for a notification (Figure 1-33).

Figure 1-33 Cases for Stock Notification

Configuring the stock content adapter

To configure the stock content adapter:

1. Open the stock1.xml file, which contains the stock information. This file is located in ins_home\samples\sm\stock, where ins_home is your Intelligent Notification Services installation directory. In the sample installation, it is the C:\Program Files\WebSphere\INS directory.

2. Look for the <nameval name=”timestamp”> element and change the value to ten minutes before the current time that is used on that server.

<nameval name="timestamp" type="string">2004-10-11 10:20:03</nameval>

3. Look for the <nameval name="last"> element, which contains the last stock price. You should set it to a value less than 50, because that is the condition that was set in the stock subscription.

<nameval name="last" type="double">44</nameval>

4. Save and close the stock1.xml file.

Before we can simulate a stock feed using the content feed application, we have to configure it by performing the following steps:

1. Open the contentfeed.bat file, which is located in the ins_home\bin directory, where ins_home is your Intelligent Notification Services installation directory. In the sample installation, it is the C:\Program Files\WebSphere\INS

directory.

2. In the Environment Setup section of this file, enter the appropriate ins_home and was_home settings as shown in the following example:

rem --- rem Environment setup

rem --- set INS_HOME=C:\Program Files\WebSphere\INS

3. Look for the line starting with "%WAS_HOME%\bin\launchclient". Add the property -CCBootstrapPort=port_number to the line.

The modified line should look like the following:

"%INS_HOME%\samples\sm\XMLContentPublisher.ear" -CCBootstrapPort=9814 -CCclasspath="%INS_HOME%\bin;%INS_HOME%\lib\insSmClient.jar" %1 "%INS_HOME%\samples\sm\%2"

The port_number is the bootstrap address of the Intelligent Notification Services application server. To determine the port number:

a. Open the WebSphere Application Server Administrative Console by clicking Start Program IBM WebSphere Application Server

V5.0 Administrative Console.

b. Expand Application Servers INSServer End Points

Bootstrap Address.

c. The port is the value in the Port field.

Running the stock application

To run the stock application:

1. In a command prompt, change the directory to ins_home\bin and simulate the stock feed by executing the following command:

contentfeed stocks stock

2. Because of the security that was enabled during the installation, you should see the window shown in Figure 1-34.

Figure 1-34 Enter security information

3. Enter your WebSphere Application Server administrative user ID and its password. In the sample installation the user ID and password is wpsbind. 4. Log in to the WebSphere Everyplace Access Portal as Christian and go to

Intelligent Notification Message Center.

5. You should see a new message from the STOCK application as shown in Figure 1-35 on page 48.

Figure 1-35 Stock notification received

6. You can select the new message to see the details (as shown in Figure 1-36).

Figure 1-36 Stock notification details

7. Open the stock1.xml file to change the stock price.

8. Change the value to higher than 100, as shown in the following example:

<nameval name="last" type="double">120</nameval>

9. Change the time to the actual server time, as shown in the following example:

<nameval name="timestamp" type="string">2004-10-11 11:20:03</nameval>

10.Save and close the file.

11.Run the content feed application again, using this command:

contentfeed stocks stock

13.Log in to the WebSphere Everyplace Access Portal as Christian and go to

Intelligent Notification Message Center.

14.You should see a new message from the STOCK application as shown in Figure 1-37.

15.If you open your e-mail client, you should see a stock message also.

Figure 1-37 Stock notification to e-mail account

16.If click the Messages Icon on your BlackBerry, you should see the message (as shown in Figure 1-38 on page 50).

Figure 1-38 Stock notification in the BlackBerry emulator

In document IBM WebSphere Everyplace Access V5 (Page 57-66)

Related documents