Monday May 26, 2014

How to create a JMS durable subscriber in WebLogic Server?

WebLogic Server Provides a set of examples that are very helpful to get started with Weblogic Server

Here you can check how to install the examples:
http://docs.oracle.com/cd/E23943_01/doc.1111/e14142/prepare.htm


After you have installed the examples, you can find the example you want to review, in this case TopicReceive, here:

wlserver_10.3/samples/server/examples/src/examples/jms/topic

To review details of the specific example, you can open:

wlserver_10.3/samples/server/examples/src/examples/jms/topic/instructions.html

To create a Durable Subscriber, you can just set the client ID  and invoke createDurableSubscriber instead of calling createSubscriber, i.e.:

   tconFactory = (TopicConnectionFactory)
      PortableRemoteObject.narrow(ctx.lookup(JMS_FACTORY),
                                  TopicConnectionFactory.class);
    tcon = tconFactory.createTopicConnection();
    //Set Client ID for this Durable Subscriber
    tcon.setClientID("GT2");
    tsession = tcon.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    topic = (Topic)
      PortableRemoteObject.narrow(ctx.lookup(topicName),
                                  Topic.class);
    // Create Durable Subscription
    tsubscriber = tsession.createDurableSubscriber(topic, "Test");
    tsubscriber.setMessageListener(this);
    tcon.start();



Enjoy!  

You can read more about this here:
http://docs.oracle.com/cd/E23943_01/web.1111/e13727/advpubsub.htm#CHDEBABC
http://docs.oracle.com/cd/E23943_01/web.1111/e13727/manage_apps.htm#i1097671    
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13943/WebLogic.Messaging.ISession.CreateDurableSubscriber_overload_2.html

Monday Apr 21, 2014

How to monitor JMS Queue counts using JConsole ?

The most common way to monitor your JMS resources is by using weblogic console, e.g.:

http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13952/taskhelp/jms_servers/MonitorJMSServers.html

You can also use WLST

http://docs.oracle.com/cd/E23943_01/web.1111/e13738/wlst.htm#i1047470

If you like JConsole, here is the trick:


1. Set your environment
   (Linux) . ./setDomainEnv.sh
   (Windows) setDomainEnv.cmd


2. Invoke jconsole using the arguments below    

jconsole -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=Location,type,Type,j2eeType,name,Name -debug


3. See messages counts as follows:


Related to the JMSServer
JMSServerRuntime > <MyJMSServer> > <MyWebLogicServer>  > Attributes > MessagesCurrentCount


Related to the a JMS Queue:
JMSDestinationRuntime > <MyQueueJNDIName>  >MyWebLogicServer > MyJMSServer > Attributes


References:
https://blogs.oracle.com/WebLogicServer/entry/managing_weblogic_servers_with


Wednesday Mar 12, 2014

I am configuring a weblogic messaging bridge. What is a member's JNDIName?

As per oracle documentation:

http://docs.oracle.com/cd/E15523_01/web.1111/e13741/bridgefaq.htm#i268720

"Messaging bridge can send to and receive from distributed destinations. Oracle recommends the following configurations:

  •  If the source is distributed destination, the bridge is pinned to one of the members when it connects to the destination. It stays connected only to that member until it reconnects. This means that the bridge will not receive messages from the other members of the distributed destination. Therefore, the best practice is to configure one bridge for each member of a distributed destinations using the member's JNDIName.

  •  If the target is a distributed destination, the best practice is to send to the distributed destination using the distributed destination's JNDIName and disable server affinity.
This allows the distributed destination to load balance incoming messages."

When you configure Uniform Distributed Queue, you can see in weblogic console:

Services > Messaging > JMS Modules > <My JMS Module> > <My Uniform DistributedQueue>  > Configuration > Members > Member Name

You will see here all member's JNDIName for each member of your Uniform Distributed Queue.
e.g.:


MyJMSServerName1@MyDistributedQueueName
MyJMSServerName2@MyDistributedQueueName


Enjoy!

Tuesday Dec 17, 2013

How to review a FileStore?

You might be interested in reviewing what is inside your FileStore, below is shown a good way to start with it.

First of all, we need to create the environment:
1. Create a Persistent  Store (FileStore) FileStore-0
2. Create JMS server target to manage server MS1, persistent Store FileStore-0
3. Create a JMS Module target to  MS1
4. Create a Connection factory JNDI name: CF  (default targeting)
5. Create a Queue JNDI name Queue-0  (subdeployment target to the JMS server)
6. Restart Managed Server


Then, lets add some messages to your queue:
1. Add QueueSend to classpath
   set CLASSPATH=C:\jms\queue send transaction;%CLASSPATH%
2. <wls_domain>/bin/. ./setDonmainEnv.sh
3. java QueueSendTX t3://localhost:7003 QueuePS1 ConnectionFactoryPS1

Finally, lets dump the FileStore to a xml file, make sure your MS1 is stopped and then execute:

1. java weblogic.store.Admin
2. openfile -store FileStore-0
3. dump -store FileStore-0 -out MyStore.xml -conn -deep
4. close -store FileStore-0
5. quit

Below you can see,
QueueSendTX.java: source code of QueueSendTX.java.
beforeConsumption.xml: is the dump when I added 9 messages to my Queue.
consumed.xml: is the dump after messages were removed from the queue.


https://blogs.oracle.com/LuzMestre/resource/QueueSendTX.java
https://blogs.oracle.com/LuzMestre/resource/beforeConsumption.xml
https://blogs.oracle.com/LuzMestre/resource/consumed.xml

Enjoy!

Monday Nov 11, 2013

How to show pending messages using WLST?

Here are the steps:

1. . ./setDomainEnv.sh
2. java weblogic.WLST
3. connect('weblogic','welcome1','t3://localhost:7001')
4. domainRuntime()
5. cd('ServerRuntimes/MS1/JMSRuntime/MS1.jms/JMSServers/JMSServer1/Destinations/JMSModule1!Queue1')
6. cursor1=cmo.getMessages('true',9999999,10)
                                                 **String(selector),Integer(timeout),Integer(state)
7. msgs = cmo.getNext(cursor1, 10)
                  ** This step gets 10 messages, you can call again cmo.getNext(cursor1, 10) to get the next 10 msgs
8. print(msgs)


My assumption, is that you had created:
a. Managed Server MS1.
b. JMS Server JMSServer1.
c. Module called JMSModule1.
d. Inside of JMSModule1, a Queue called Queue1.



If you read my previous post:

How to get Messages Pending Count from a Queue using WLST?
https://blogs.oracle.com/LuzMestre/entry/how_to_get_messages_pending

You can see that both are very similar.  Sometimes it is difficult to get a WLST Script sample, but you can use ls() function to know about other functionalities you don't have a sample code.

***Until step 5, nothing new comparing to my previous post.
5. cd('ServerRuntimes/MS1/JMSRuntime/MS1.jms/JMSServers/JMSServer1/Destinations/JMSModule1!Queue1')
6. ls()


You will see, MessagesPendingCount, getMessages along a lot of other functionalities available in this Queue.

e.g, you can see:
-r-x   getMessages                                  String : String(selector),Integer(timeout),Integer(state)

Here you can check the complete MBean Reference:
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13951/core/index.html
See JMSDestinationRuntimeMBean.

Enjoy!

Wednesday Oct 30, 2013

How to get Messages Pending Count from a Queue using WLST?

WLST is a scripting Language that helps to achieve similar functionality as the ones you have in WebLogic console, but in a command line fashion.

You can develop your WLST Scripts using Eclipse OEPE, read more here:
https://blogs.oracle.com/oepe/entry/new_oracle_enterprise_pack_for


Finally, here is an example to get Messages Pending Count using WLST:

 . ./setDomainEnv.sh
 java weblogic.WLST
 connect('weblogic','welcome1','t3://localhost:7001')
 domainRuntime()
 jms= getMBean ('ServerRuntimes/MyManagedServer/JMSRuntime/MyManagedServer.jms/JMSServers/MyJMSServer/Destinations/MyModule!MyQueue')
 jms.getMessagesPendingCount()



Enjoy!

WLST documentation:
http://docs.oracle.com/middleware/1212/wls/WLSTG/index.html
About


My name is Luz Mestre. I work as Principal Technical Support Engineer at Oracle Support. I'll post here the most interesting challenges I have in my daily work. The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« March 2015
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today