Ways to Calculate Number of Messages in OpenMQ

Hello All,
I was wondering if there is a way to calculate Number of messages already present in a Queue (OpenMQ).
1. One way is to make a synchronized static variable .. On each push increment and on listeners pull decrement it. But it have its own flaws i.e On system shutdown we will loss this info even if the messages exists in the queue. OR if me make it persistent then it will take extra processing time.
Do some body know any other way to do it ? I have to do it using JAVA code.
Kind Regards
Shakeel Abbas

Thank you Nigel,
For others information i am pasting some code here..
import java.io.IOException;
import javax.management.JMException;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import com.sun.messaging.AdminConnectionFactory;
import com.sun.messaging.jms.management.server.DestinationAttributes;
import com.sun.messaging.jms.management.server.DestinationType;
import com.sun.messaging.jms.management.server.MQObjectName;
Public Class MonitorQueue
public static void main(String[] args) {
          try {
               ObjectName destMonitorName
               = MQObjectName.createDestinationMonitor(DestinationType.QUEUE, "queueNAme");
               // Create admin connection factory for default host and port (localhost:7676)
                  AdminConnectionFactory acf = new AdminConnectionFactory();
               // Get JMX connector using default user name (admin) and password (admin)
                  JMXConnector jmxc = acf.createConnection("admin","admin");
               // Get MBean server connection
                  MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
                  System.out.println(mbsc.getAttribute(destMonitorName, DestinationAttributes.NUM_MSGS));
          } catch (MalformedObjectNameException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
          } catch (NullPointerException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
          } catch (JMException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
          } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
}Stay Happy Cheers
Shakeel Abbas

Similar Messages

  • I used to have a IPhone3 about three years ago, unfortunately i do not have it anymore. My question is is there a way to obtain deleted text messages from my phone number from a short period of time before i got rid of my phone?

    About three years ago in 1012 I had an iphone3 sent and deleted text messages of course and as of now those text messages are needed for an upcoming court case i will be involved with. So is there any way to retrieve those text messages from three years ago. I am just in need of the text messages from February 2012 on. So its about 6 to 10 months of texts. what do I have to do to get them back if possible???

    As the others noted, if you don't have any older iTunes backups then the deleted messages would not be recoverable. The free trial of Decipher TextMessage will show you if there are any text messages in your older backups that can be recovered.

  • Is there a way to delete all the messages for a user in CUC 8.6 ?

    With Unity it was possible as an administrator, to delete all the messages in a user's mailbox, directly from the server (Windows).  Now, with Unity Connection (8.6.1) is there a way to do the same ?  When I'm logged as an administrator, I can see, for every user, the number of messages and the size (Mailbox menu) that they have in their mailbox, but what I want to do is to be able to delete all the messages for a specific user... Is it possible with CUC 8.6.1 ?

    Hi there,
    The best way with Unity Connection is with the use of this excellent tool from
    the great suite of Unity Tools (** "reset" feature);
    Unity Connection Bulk User Delete   
    For resetting users you have the option of emptying the mailbox, resetting greetings, deleting voice names, resetting passwords, removing private lists and a number of other options you may choose.  For installations where the user base “changes over” frequently such as schools this may be a nicer option.  This option is also allowed for CoRes installations since it does not involve the removal of user objects from the Connection database.
    http://www.ciscounitytools.com/Applications/CxN/BulkUserDelete/BulkUserDelete.html
    Cheers!
    Rob

  • How do i find the number of messages in a queue

    Sorry if this is too trivial, but i haven't been able to figure out how to determine the number of messages in a queue. business case being that i can only have 3 messages in the send queue, so i need to stop sending if there are 3 outstanding messages still in the send queue.
    Can someone point the way?
    Thanks,
    Nilesh

    Hi,
    To get the depth using JMS you must create a QueueBrowse and browse the entire queue. Its generally horribly inefficient if you want to do it with any regularity.
    In Hermes I have had to write plugins that open separate connections to providers using their non-JMS APIs or JMX and get that kind of information that way.
    Look at the getDepth() method in this JBoss plugin for an example that uses JMX:
    http://cvs.sourceforge.net/viewcvs.py/hermesjms/Hermes4/src/java/hermes/ext/jbossmq/JBossMQAdmin.java?view=markup
    And here is one for WebSphereMQ that uses one of its many APIs..
    http://cvs.sourceforge.net/viewcvs.py/hermesjms/Hermes4/src/java/hermes/ext/mq/MQSeriesAdmin.java?view=markup
    Colin.
    http://hermesjms.com

  • How to get the number of messages consumed by a MDB ??

    Hi all,
    How to get the number of messages consumed by a MDB displayed in OEM in a Java Application ???
    DMS ??? what use DMS ???
    tanks

    ok.
    Well using DMS is one way to get at these sorts of stats in a programmatic manner.
    There's a Java API you can use, or you could call out to the Spy servlet to query the DMS stats in either text or XML form.
    I don't have an MDB published so I can't show you specifiically, but here's the sort of query you can use to extract the data.
    http://localhost:8888/dms0/Spy?format=raw&table=oc4j_ejb_stateless_bean&recurse=children
    Which produces a table of the TEXT form:
    <DMSDUMP version='9.0.4' timestamp='1163456821185 (Tue Nov 14 08:57:01 CST 2006)' id='8888' name='OC4J'>
    <statistics>
    /oc4j [type=n/a]
    /oc4j/default [type=oc4j_ear]
    /oc4j/default/EJBs [type=oc4j_ejb]
    /oc4j/default/EJBs/jmsrouter_ejb [type=oc4j_ejb_pkg]
    /oc4j/default/EJBs/jmsrouter_ejb/AdminMgrBean [type=oc4j_ejb_stateless_bean]
    pooled.count:     11     ops
    pooled.maxValue:     1     count
    pooled.minValue:     0     count
    pooled.value:     0     count
    ready.count:     11     ops
    ready.maxValue:     1     count
    ready.minValue:     0     count
    ready.value:     0     count
    session-type.value:     Stateless     
    transaction-type.value:     Bean     
    /oc4j/default/EJBs/jmsrouter_ejb/EnqueuerBean [type=oc4j_ejb_stateless_bean]
    pooled.count:     11     ops
    pooled.maxValue:     0     count
    pooled.minValue:     0     count
    pooled.value:     0     count
    ready.count:     11     ops
    ready.maxValue:     0     count
    ready.minValue:     0     count
    ready.value:     0     count
    session-type.value:     Stateless     
    transaction-type.value:     Bean     
    /oc4j/default/EJBs/jmsrouter_ejb/TimerHandlerBean [type=oc4j_ejb_stateless_bean]
    pooled.count:     11     ops
    pooled.maxValue:     0     count
    pooled.minValue:     0     count
    pooled.value:     0     count
    ready.count:     11     ops
    ready.maxValue:     0     count
    ready.minValue:     0     count
    ready.value:     0     count
    session-type.value:     Stateless     
    transaction-type.value:     Bean     
    </statistics>
    </DMSDUMP>
    Or produces an XML document of the form:
    http://localhost:8888/dms0/Spy?format=xml&table=oc4j_ejb_stateless_bean&recurse=children
    You can use the Spy console to find the table that contains the details for MDB and then take it from there.
    This is not what you specifically want to do, but it does provide a good overview of how DMS is used.
    http://www.oracle.com/technology/pub/notes/technote_dms.html
    -steve-

  • How to determine the number of messages in a queue, that ...

    Hi,
    what's the proper way to count the number of the messages in an Advanced Queue that are currently visible to consumers?
    Currently we use:
    select count(*) from aq$queue_tab_name q where q.QUEUE = 'Q_NAME';
    The problem with that approach:
    If one consumer dequeues a lot of messages in one transaction, that change in the number of messages visible to other consumers is only made visible after the consumer issues a commit. Before the commit is issued, the above "select count(*) ..." statement (issued from a different DB-session) does not reflect the fact that one consumer consumed a lot of messages, messages that are not available to other consumers anymore (only exception: the original consumer issues a rollback sooner or later).
    So before the commit is issued:
    -the consumed messages are NOT visible to other consumers anymore (which is intended behaviour)
    -but the "select count(*) ..." statement (issued from a different DB session) does NOT reflect that fact
    So the case could arise that the queue becomes empty, while "select count(*) ..." says that e.g. 1000 messages are still in the queue.
    Is there a solution to this problem?
    PS: For our use-case we need these dequeue option :
    dbms_aq.remove;
    dbms_aq.first_message;
    dbms_aq.on_commit;
    Again, the queue itself works correctly, I just need to find a way to determine the number messages that are currently dequeable / visible to the consumers at specific point in time.
    I couldn't find a func/proc in dbms_aq for that purpose.
    Best wishes
    Peter

    The following might be of interest in better understanding the issue you are facing in a broader context:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5771117722373

  • HT201774 How do I delete excess email messages from my iPhone.  There are 300 messages listed, and every time I delete some, more are added from old messages.  How do I limit the number of messages that can appear on my phone?  How can I delete messages i

    How do I delete excess email messages from my iPhone.  There are 300 messages listed, and every time I delete some, more are added from old messages.  How do I limit the number of messages that can appear on my phone?  How can I delete messages in bulk,

    You can't.
    All photos transferred from your computer are stored in the Photo Library. The photos in the album or albums below are not duplicates - they include a pointer to the original photos stored in the Photo Library. This way you can view the photos in a particular album only by selecting the album, or you can view all photos available in all albums by selecting Photo Library.
    Just as with an iTunes playlist. A song cannot be in an iTunes playlist unless the song is in the main iTunes library. Placing a song in a playlist does not duplicate the song. Remove the main iTunes library or the songs from the main iTunes library that are in a playlist and the songs will no longer be in the playlist either. This way you can listen to the songs in the playlist only by selecting the playlist, or all songs in your entire iTunes library by selecting Music under Library in the iTunes source list.
    The same with iPhoto on a Mac. A photo cannot be in an in iPhoto Event or Album unless the photo is in the main iPhoto library. Placing a photo in an Event or Album does not duplicate the photo. This way you can view the photos in an iPhoto Event or Album only by selecting the Event or Album, or all photos in all Events or Albums.

  • Number of messages in Sent folder

    Since I was 'migrated' a month ago I've been keeping a daily eye on the number of messages in my Sent folder.  Strangely the total is invariably 166!  This is most odd; though my email traffic is generally modest, I send out an average 10-15 messages daily. 
    I retain a large archive of old messages, chiefly in comnnection with my family history research, and the number of my messages listed on WLM is way in excess of 166, so what is happening to the messages 'falling off the end' on BTMail?  Or is this 'just another glitch', that proves that BTMail can't count?

    Which phone do you have ? ...or do you have problems with OVI sync ?
    See if you have these options..
    Messaging-->Options-->Settings-->Other-->No. of saved messages.. set as 999(max.)
    Check if this makes any difference..
    --------------------------------------------------​--------------------------------------------------------​--------------------------------------------------​--If you find this helpful, pl. hit the White Star in Green Box...

  • JMS limiting number of messages

    Is there a way to limit the number of messages or the amount of memory a jms queue uses? Currently having a problem with a queue bringing down the entire system when it gets flooded with messages.

    Is this not possible with jms in oracles application server?

  • Number of messages in Smart Mailbox

    A question & some relavent thoughts:
    In Mail, the number of Unread messages is shown the right of each mailbox.  But what are the total number messages?   Alternatively, how many Read messages are there?
    I have many folders.  I am trying to create separate mailboxes for each important (to me) Sender.  Then it would be possible to find out how many messages were in 1 Smart Mailbox not contained in any other Smart Mail Box by
    1. having a Smart Mailbox containing all mail, and
    2. specifying conditions: From ...  Does not contain ...   Sender
    3. for each Sender
    This would be very tedious if one receives mail from many senders.  However, if
    1. all senders belong to at least 1 Group,
    this might be onerous but at least feasible.
    If however,there were a Smart Mailbox condition:
    2. Group ...  Does not contain ...   Sender,
    then this would feasible witnout being too onerous.
    If anyone has any answers and/or suggestions,  I would be very happy to receive same!
    Chuck

    I have had the same problem as well and could not find any way of fixing it! Also when I changed the name of the folder the message count disappeared for a while and then seemed to come back later... very bizarre.
    Anyway, I may have found a solution after spending all afternoon searching the internet on macosxhints. [Link goes to the specific hint].
    I would advise making a complete back-up of your ~/Library/Mail folder before trying this, though. When I did this it seemed to re-import some messages and mark them as unread for some unknown reason. However, I went through and marked them all as 'read', and I have the same number of messages in each mailbox as I did before I tried this, so I can only assume that things are the same as before.
    One thing has changed, however! I no longer have a false number on the 'Flagged' messages smart mailbox! (Although if you have lots of messages marked as 'flagged' it may clear the flag - not sure).
    2Ghz iMac G5   Mac OS X (10.4.4)   4G iPod

  • Message Monitoring - Shows Number of Messages but no Messages or Data

    Hello All,
    We are facing an issue in Message Monitoring. When we see the Message Monitoring (Database Overview) for the Adapter Engine. It shows the number of Messages that were Successful,
    but if we click the Successful  messages it shows "0 Messages Found"
    This was just happening for only Messages which are older than 3 days. Are there any jobs that delete these messages?
    We are running on SAP PI 7.31 Dual Installation.
    Thanks,
    Harsh

    Hi Harsh -
    it shows "Persist Until" - Next Day same time the message was sent. Does this mean, I can't see the message after the persisted time??
    >>>in a way Yes. but AFAIK - you would still be able to access until the next execution of your delete job.
    i.e. If your message has "persists until" value as tomorrow afternoon and your delete job is scheduled to run tomorrow evening then i think you should be able to access those messages until the job finishes..
    where can I change the persistence duration? Should I change the Default Delete Job time
    >>> changing the default job schedule will not be helpful.
    You might have to adjust the property " xiadapter.inbound.persistDuration.default " under the XPI Adapter: XI service
    ( NWA -> configuration->infrastcrture-> java system properties ->services ->XPI Adapter: XI)
    But in case you want to keep it for longer duration may be setup archiving..
    AAE Archiving in SAP PI 7.11 with XMLDAS

  • Can i limit the number of messages saved on N97???

    hello everyone.
    i wanted to ask if there is a way to limit the amount of messages (SMS's) that the N97 saves.
    i noticed that in the out-going SMS folder i never have more than 20 messages (i cant remember if this was default or if i set it up this way). however my SMS inbox has no limit, right now for example i have 77 msg's in there.
    i would like to limit my inbox also to X messages.
    is there anyway to do that?
    thx

    Hi, all you have to do is go into messaging-options-other-set number of messages(and while you're there set memory in use to E)
    Good Luck, and Kudos is always appreciated 
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Count the number of message in remote queue.

    Does any method in MQSeries or JMS, can count the number of message in remote queue.
    I try to use QueueBrowser to browser, but got exception when browse the remote queue.
    thanks.

    You cannot read from, browse or query a remote MQ Queue, only write to it. Try www.mqseries.net or ibm website for any ways around this...

  • How do I change the mobile number re messages on iPad air

    How do I chane the mobile number re messages on my new ipad air.  It seems to be coming up with my husbands number ...

    Are you using your husband's Apple ID from his iPhone?
    Do you have an iPhone associated with your Apple ID?
    To associate Messages on an iPad with a phone number you need to have an iPhone that has the Phone number so it can be associated with the Apple ID being used on both devices (iPhone and iPad).
    Malocolm wrote:
    Which do you mean.
    I sort of was refering to both.
    If you have a plan, it's just LTE, or wireless on the go.
    Apple doesnt give you a phone number, thats the way they've been manufacturing iPads, just with Wireless plans.
    Apple doesn't give out phone numbers or wireless plans. Only the cell carriers do that.   While A Cell Plan for an iPad has a number its just for Identification purposes by the carrier, and cannot be used for Messages. 
    Also it is not necessarry to have a cellular iPad with a cellular plan to have a number for messages. As I said, you need an iPhone to do this.

  • Hi! Is there any way I can save my messages in Imessage?

    Hi! Is there any way I can save my messages in Imessage aside from taking screenshots of it?

    Shaun,
    Recently I got an iPhone 5 and when I activated it, I lost all of my voicemails from my previouse phone.  With Verizon (I'm not sure about other carrier's), they were able to provide me with a phone number where I could access my old messages.  I then used a website www.SaveMyVM.com to make permanemnt MP3 backups of them.
    I believe the messages only remain on Verizon's system for a few days after activating a new phone, so time I would give them a call as soon as possible.
    Hope this helps,
    Jaimie

Maybe you are looking for

  • Domain name/host name/external hosts

    I have an external website, for argument sake: waterworld.net I want to host the mail internally, and i have set up DNS records with my name registrar that has the A record point to my external web host, and I have created an MX record of "mail.water

  • Exchange 2003 - 2010. Moving public folders one at a time

    Hi all, I'm in the process of decomisioning our old Exchange 2003 server (long overdue after what has been a relativly smooth and trouble free transition to 2010). As the first step in the decomisioning process, I'm looking to move the public folders

  • Oracle AS Adapter for SAP R/3

    Hello everyone. I have some questions abuot the Oracle AS Adabter for SAP. I have to get values out of miniSAP and integrate them in a BPEL Process. In SAP there is a function to generate a Webservice out of a BAPI for example! This Web Service I wan

  • PDF form only allow saving as a copy

    Hi, Have an Adobe PDF form in Adobe Reader X that only allows you to save a copy of the form when data is entered into the fields.  Every time I make any changes to the form fields and hit the save button it is asking me to save under a new name.  I

  • My Setting, Contacts and reminders has stopped working.  I am on IOS5

    Settings, reminders, contacts have stopped working.  settings opens but locks up.  Reminders and contacts open but there is nothing there.