WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.jms.startup
Class PoolReceive

java.lang.Object
  |
  +--examples.jms.startup.PoolReceive
All Implemented Interfaces:
weblogic.common.T3StartupDef

public class PoolReceive
extends java.lang.Object
implements weblogic.common.T3StartupDef

This example shows how to establish a pool of message listeners (MsgListener class) from a startup class. As messages are received from the topic they are displayed in the shell running the WebLogic Server. You can use the TopicSend client to send messages to the topic.

The following sections describe how to:

  1. Build the example
  2. Configure the server
  3. Run the example

Build the Example

  1. Set up your development shell, as described in Setting up your environment.
  2. Compile the example by executing the following command or by executing the build script provided for this example in the samples/examples/jms/startup directory. The script will perform the following step:

    Compile the PoolReceive as shown in this example for Windows NT/2000:

      $ javac -d %SERVER_CLASSES% MsgListener.java PoolReceive.java

Configure the Server

The WebLogic startup class has been preconfigured for you convenience. You must deploy the startup class on the server, as described in the following procedure.

To configure the server:

  1. Start the server with the examples configuration.
  2. Bring up the Administration Console in your browser.
  3. Click to expand the Deployments node in the left pane.
  4. Click to expand the Startup & Shutdown node in the left pane.
  5. Choose the server target for the poolReceive startup class as follows:
    1. Select the poolReceive node. The poolReceive startup class configuration information displays in the right pane.
    2. Select the Targets tab in the right pane to display the Available and Chosen targets.
    3. Move the examplesServer target to the Chosen column and click the Apply button to save the assignment.
    Note: If you have configured the server to run the examples.jms.topic example, then no additional configuration changes are required to run the ServerReceive example. You can skip to the section Run the Example.
  6. Click to expand the JMS node in the left pane.
  7. Click to expand the JMS Connection Factories node in the left pane.
  8. Choose the server target for the exampleTopic connection factory as follows:
    1. Select the exampleTopic node. The exampleTopic connection factory configuration information displays in the right pane.
    2. Select the Targets tab in the right pane to display the Available and Chosen targets.
    3. Move the examplesServer target to the Chosen column and click the Apply button to save the assignment.

    Note: Normally, you would also have to choose one or more targets for the JMS server associated with the topic. For your convenience, the examplesJMSServer server has been preconfigured to include the examplesServer as a chosen target.

Run the Example

  1. Restart the server to invoke the startup class.
  2. Start the TopicSend client in your development shell and send messages to the topic. The messages are displayed in the shell running WebLogic Server as they are received from the topic. Send messages at less than 1 second intervals to see the pool in action.

Author:
Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
PoolReceive()
           
 
Method Summary
 void setServices(weblogic.common.T3ServicesDef services)
          Pass to the startup class the handle of an object that can be used to access WebLogic services.
 java.lang.String startup(java.lang.String name, java.util.Hashtable args)
          Create consumer.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolReceive

public PoolReceive()
Method Detail

setServices

public void setServices(weblogic.common.T3ServicesDef services)
Pass to the startup class the handle of an object that can be used to access WebLogic services. This makes another reference to the services object so it can be used later.
Specified by:
setServices in interface weblogic.common.T3StartupDef
Parameters:
services - Services stub.

startup

public java.lang.String startup(java.lang.String name,
                                java.util.Hashtable args)
                         throws java.lang.Exception
Create consumer.
Specified by:
startup in interface weblogic.common.T3StartupDef
Parameters:
name - Name.
args - Hashtable.
Throws:
java.lang.Exception - if problems occurs

Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.