|
| WebLogic Server 6.0 Code Examples, BEA Systems, Inc. |
SUMMARY: INNER | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD |
examples.jms.startup
Class ServerReceive
java.lang.Object
|
+--examples.jms.startup.ServerReceive
- All Implemented Interfaces:
- javax.jms.MessageListener, weblogic.common.T3StartupDef
- public class ServerReceive
- extends java.lang.Object
- implements javax.jms.MessageListener, weblogic.common.T3StartupDef
This example
establishes a single message listener. As messages are
received from the topic, they are displayed in the shell
running the WebLogic Server and written to the weblogic.log file.
You can use the
TopicSend client
to send messages to the topic.
The following sections describe how to:
- Build the example
- Configure the server
- Run the example
- Set up your development shell, as described in
Setting up
your environment.
-
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 ServerReceive as shown in this example for Windows NT/2000:
$ javac -d %SERVER_CLASSES% ServerReceive.java
The WebLogic startup class has been preconfigured for your convenience. You
must deploy the startup class on the server, as described in the
following procedure.
To configure the server:
-
Start the server with the examples configuration.
-
Bring up the Administration Console in your browser.
-
Click to expand the Deployments node in the left pane.
-
Click to expand the Startup & Shutdown node in the left pane.
-
Choose the server target for the serverReceive startup class as follows:
-
Select the serverReceive node.
The serverReceive startup class configuration information displays
in the right pane.
-
Select the Targets tab in the right pane to display the Available and Chosen
targets.
-
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.
-
Click to expand the JMS node in the left pane.
-
Click to expand the JMS Connection Factories node in the left pane.
-
Choose the server target for the exampleTopic connection factory as follows:
-
Select the exampleTopic node.
The exampleTopic connection factory configuration information displays
in the right pane.
-
Select the Targets tab in the right pane to display the Available and Chosen
targets.
-
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
-
Restart the server to
invoke the startup class.
-
Start the
TopicSend client in your
development shell and send messages to the topic.
The
ServerReceive startup class displays messages in the shell running
WebLogic Server and writes them to the weblogic.log file
as they are
received from the topic.
- Author:
- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
Method Summary |
void |
onMessage(javax.jms.Message msg)
Message listener interface. |
void |
setServices(weblogic.common.T3ServicesDef services)
Passes 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)
Creates a consumer. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServerReceive
public ServerReceive()
onMessage
public void onMessage(javax.jms.Message msg)
- Message listener interface.
- Specified by:
onMessage
in interface javax.jms.MessageListener
- Parameters:
msg
- message
setServices
public void setServices(weblogic.common.T3ServicesDef services)
- Passes 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
- Creates a consumer.
- Specified by:
startup
in interface weblogic.common.T3StartupDef
- Parameters:
name
- nameargs
- environment- Throws:
java.lang.Exception
- if problem occurs
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.