How do I use a third-party JDBC driver with JMS?
If your JDBC driver is not included in the list of
drivers in the question about JDBC databases supported
by WebLogic JMS, then the tables required by JMS must be
created manually.
Note: WebLogic Server only guarantees support for the
JDBC drivers included in the previous list. Support for
any other JDBC driver is not guaranteed.
The .ddl files located in the weblogic/jms/ddl directory
of the weblogic.jar file may be used as templates. Use
the jar utility supplied with the JDK to extract them to
the weblogic/jms/ddl directory using the following
command:
jar xf weblogic.jar weblogic/jms/ddl
Note: If you omit the second parameter (weblogic/jms/ddl),
the entire jar file is extracted.
Follow the procedures in JDBC Database Utility in
Programming WebLogic JMS to manually create the database
tables for the JDBC store.
Another option is to consider using a file store instead
of a JDBC store. File stores are easier to configure and
may provide significantly better performance.
The Multicast TTL setting for a cluster in the WebLogic
Admin console sets which of the following values?
a. Maximum time taken for multicast messages to reach
their final destination
b. The number of routers a multicast message can pass
through before the packet can be discarded
c. The multicast address to be used by the messages sent
from the cluster
d. Minimum time taken for broadcasting a multicast
message from the cluster
Choice B is correct. The Multicast TTL(TTL-Time to Live)
setting specifies the number of routers a multicast
message can pass through before the packet can be
discarded. To configure the multicast TTL for a cluster,
you should change the Multicast TTL value in the
WebLogic Server administration console. This sets the
number of network hops a multicast message makes before
the packet can be discarded.
If you choose to distribute a cluster over a WAN (or
across multiple subnets), you must plan and configure
your network topology to ensure that multicast messages
are reliably transmitted to all servers in the cluster.
One of the requirements to be met by the network is that
the multicast Time To Live (TTL) value must be high
enough to ensure that routers do not discard multicast
packets before they reach their final destination.
Which of the following algorithms is used by the
WebLogic Server as the default load balancing strategy
for clustered object stubs when no algorithm is
specified ?
a. Round-robin
b. Weight-based
c. Random
d. None of the above
8. Choice A is correct. The basic idea behind load
balancing is that by distributing the load
proportionally among all the servers in the cluster, the
servers can each run at full capacity. WebLogic Server
clusters support several algorithms for load balancing
clustered objects. The particular algorithm you choose
is maintained within the replica-aware stub obtained for
the clustered object. Configurable algorithms for load
balancing clustered objects are: Round-robin,
Weight-based and Random.
WebLogic Server uses the round-robin algorithm as the
default load balancing strategy for clustered object
stubs when no algorithm is specified. Round-robin is the
only load balancing strategy used by WebLogic proxy
plug-ins for HTTP session state clustering. The
round-robin algorithm cycles through a list of WebLogic
Server instances in order. For clustered objects, the
server list consists of WebLogic Server instances that
host the clustered object. For proxy plug-ins, the list
consists of all WebLogic Servers that host the clustered
servlet or JSP.
How do I use persistence?
Use the following guidelines:
1. Make sure the JMSServer you are using has a store
configured. The JMSServer configuration entry in the
config.xml file should contain a line of the form
Store="<YOUR-STORE-NAME>"
Note that if JMS boots without a store configured, it is
assumed the customer did not want one, and persistent
messages are silently downgraded to non-persistent (as
specified for JMS 1.0.2).
2. Make sure you are not using "Message.setJMSDeliveryMode".
This is overwritten, as it is a vendor-only method.
3. Make sure you are calling either:
QueueSender.send(msg, deliveryMode, ...)
-- or --
QueueSender.setDeliveryMode(deliveryMode)
-- or --
set the DefaultDeliveryMode mode on connection factory
in the config.xml file to persistent (the
QueueSender.setDeliver/send overrides this value).
Similarly, for topics, you would set this via the
TopicPublisher.
4. Make sure you don't have "DeliveryModeOverride" set
to Non-Persistent on the Destination in the config.xml
file.
5. If you are using pub/sub, only durable subscriptions
persist messages. Non-durable subscriptions have no need
to persist messages, as by definition they only exist
for the life of the server.
6. If you are using JDBC, the JDBC tables, JMSSTATE and
JMSSTORE, are created automatically when the JMS server
boots. The DDL files used to create the tables are
stored in weblogic.jar in weblogic/jms/ddl. The example
configuration below shows a JDBC store for Oracle
(client version 8.1.7 or later is needed to run with WLS
6.1 on JDK 1.3). To manually create the tables (also
deleting any existing tables), run java utils.Schema as
described in the previous question.
See the question, "How do I start WLS and configure
JMS?" for a description of how to configure JMS.
Here is a sample config.xml file resulting from
configuring JMS. It should look similar to yours. If you
want JMS to use a file store instead of a database, just
change JDBCStore to FileStore in the JMSServer section.
<Server Name="myserver"
ListenPort="7001" DefaultProtocol="t3"
ThreadPoolSize="8" >
</Server>
<Security Realm="defaultRealm"
GuestDisabled="false" />
<Realm Name="defaultRealm"
FileRealm="defaultFileRealm" />
<FileRealm Name="defaultFileRealm"
/>
<JMSServer Name="TestJMSServer"
TemporaryTemplate="TestTemplate1"
Targets="myserver" Store="JDBCStore">
<JMSQueue Name="TestQueue1"
JNDIName="jms.queue.TestQueue1"
Template="TestTemplate1"
/>
</JMSServer>
<JMSTemplate Name="TestTemplate1"
/>
<JMSFileStore Name="FileStore"
Directory="myfilestore"
JMSServer="TestJMSServer"
/>
<JMSJDBCStore Name="JDBCStore"
ConnectionPool="testpool2"
JMSServer="TestJMSServer"
/>
<JDBCConnectionPool Name="testpool2"
Targets="myserver"
URL="jdbc:weblogic:oracle"
DriverName="weblogic.jdbc.oci.Driver"
InitialCapacity="0"
MaxCapacity="1"
CapacityIncrement="1"
Properties="user=SCOTT;password=tiger;server=bay816"
/>
</Domain>
The following is a sample class that sends
a Topic message on construction:
import javax.naming.*;
import javax.jms.*;
import java.util.Hashtable;
public class t
{
public final static String
DESTINATION="jms.topic.TestTopic1";
private TopicConnectionFactory connectionFactory;
private TopicConnection connection;
private TopicSession session;
private TopicPublisher producer;
private TextMessage message;
private Topic destination;
public t()
{
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
InitialContext ctx = new InitialContext(env);
destination = (Topic) ctx.lookup(DESTINATION);
connectionFactory = (TopicConnectionFactory)
ctx.lookup("javax.jms.TopicConnectionFactory");
connection = (TopicConnection)
connectionFactory.createTopicConnection();
session = (TopicSession)
connection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
producer = (TopicPublisher)
session.createPublisher(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
message = (TextMessage) session.createTextMessage();
message.setText("hello world");
producer.publish(message);
} catch (Exception e) {
}
}
}
Page Numbers :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18