Tuesday, May 17, 2011

Basic JMS Clustering with Weblogic 11g - standalone Queue/Service Migration

In this scenario we need to make a standalone Queue highly available.

The Queue will be targeted to JMSServer2 running on MgdServer2.
If MgdServer2 goes down then the JMSServer will be migrated to MgdServer1.


Here I strongly suggest you consult the weblogic docs to understand fully
the concepts. Here is a short extract from the aforementioned -
------------------------------------------------------------------------
In a WebLogic Server cluster, most subsystem services are hosted homogeneously on all server instances in the cluster, enabling transparent failover from one server to another. In contrast, pinned services, such as JMS-related services, the JTA Transaction Recovery Service, and user-defined singleton services are hosted on individual server instances within a cluster—for these services, the WebLogic Server migration framework supports failure recovery with service migration, as opposed to failover.

Service-level migration in WebLogic Server is the process of moving the pinned services from one server instance to a different available server instance within the cluster. Service migration is controlled by logical migratable target, which serves as a grouping of services that is hosted on only one physical server in a cluster. You can select a migratable target in place of a server or cluster when targeting certain pinned services. High availability is achieved by migrating a migratable target from one clustered server to another when a problem occurs on the original server. You can also manually migrate a migratable target for scheduled maintenance or you can configure the migratable target for automatic migration.



------------------------------------------------------------------------
Leading on from the previous post...

Create a second JMS Server - JMSServer2 and target to MgdServer2(Migratable)



Step 1 - Create a new JMS module /Connection Factory and Queue



Subdeployment targeted as follows -



Create the connection Factory and target as follows -





Create the Queue, target to JMSServer2





Test -

------------------------------------------

public static void main(String [] args) throws JMSException,
NamingException {
final Context ic = getInitialContext();
System.out.println("*** CONTEXT =");
final QueueConnectionFactory qcf = (QueueConnectionFactory)ic.lookup("jms/MyCF2");
// Lookup should specify the queue name that is mentioned as "mappedName" in MessageDriven Bean.
final Queue destQueue = (Queue)ic.lookup("jms/MyQueue2");
ic.close();
final QueueConnection connection = qcf.createQueueConnection();
try {
final QueueSession session = connection.createQueueSession(false, 0);
final QueueSender sender = session.createSender(destQueue);
final TextMessage msg = session.createTextMessage("Hello from Dublin - fans of FCN");
sender.send(msg);
-------------------------------------------

View message in the WLS console



We can also enable logging on the Queue





Re-test and view logs



Now stop MgdServer2 and re-test



View logs under MgdServer1

2 comments:

Anonymous said...

Raphael.

Please can you give more details about configuring migartable Mdgserver1 and 2. because the example doesn't work.

Niall Commiskey said...

Hi Raphael,

did you check the official Oracle docs I mention?