ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » open/close queue

Post new topic  Reply to topic
 open/close queue « View previous topic :: View next topic » 
Author Message
emaster
PostPosted: Thu May 02, 2002 5:54 am    Post subject: Reply with quote

Novice

Joined: 15 Apr 2002
Posts: 10

I am new to using the MQSeries Java classes. Is it possible to open a queue and keep it open allowing all requests to use the open queue OR should each request open and close the queue.

We are planning to run this over our intranet in our call centers. Each person on the phone is requesting data but I am opening and closing the queue for each request. All the examples I have seen do the same - open the queue, send the message, retrieve the message, close the queue and disconnect. Is it possible to always have the queue open and just send and retrieve the messages? Does opening and closing the queue cause additional overhead?

Thanks for any information in advance.

Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Thu May 02, 2002 8:28 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

There is a LOT of overhead in opening a queue, compared to PUTTING/GETTING. When you open a queue, you are returned a queue handle that you use on subsequent actions to that queue. So if you open the queue for putting and/or getting, then save that handle, you can keep looping on that queue for as long as you want without reoppening/closing, provided that you use that same queue handle. If another app wants to access that same queue, they should get their own handle by doing their own OPEN call.

When done, every app should always CLOSE the queue (don't just disconnect and assume MQ will close it for you properly every time just cause you went away)

_________________
Peter Potkay
MQSeries Certified Specialist,Developer

[ This Message was edited by: PeterPotkay on 2002-05-02 09:29 ]
Back to top
View user's profile Send private message
emaster
PostPosted: Thu May 02, 2002 9:16 am    Post subject: Reply with quote

Novice

Joined: 15 Apr 2002
Posts: 10

Thanks for the quick reply.

I am not sure if I asked the question correctly because I am still unsure.
I hope I can clarify:

Is it possible to lets say create a servlet that opens and queue and keeps it open indefinitely. I create a class that will use that open queue for all my customer requests...meaning when my customers request a message I do not have to open the queue each tme...it is sitting open waiting for my request and I can just get the handle from the servlet running. I then alleviate the open/close in my application because the queue is always available.

My goal is to get the best performance possible.
Thanks again for any help.
Back to top
View user's profile Send private message
bduncan
PostPosted: Thu May 02, 2002 9:53 am    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

emaster,
If you are doing this as a java servlet, then the answer is pretty straightforward. The servlet model provides you with an init() method which gets called ONCE during the lifetime of the servlet. After init() is called, then the servlet is ready to service requests. If you do your MQOPEN within the init() method and store the handle, you can then reuse this handle in all subsequent web requests.
Here's an excerpt from a Sun white papers on servlets: http://java.sun.com/products/servlet/whitepaper.html

Quote:
"Servlets are activated by the server through an init call. Servlet writers may, if they wish, provide their own implementation of this call, to perform potentially costly (usually, I/O intensive) setup only once, rather than once per request. Examples of such setup include initializing sessions with other network services or getting access to their persistent data (stored in a database or file)."


In this case, other network services mean things like MQSeries


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator

[ This Message was edited by: bduncan on 2002-05-02 10:54 ]
Back to top
View user's profile Send private message Visit poster's website AIM Address
emaster
PostPosted: Thu May 02, 2002 10:30 am    Post subject: Reply with quote

Novice

Joined: 15 Apr 2002
Posts: 10

Thank you very much that is what I needed to know.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » open/close queue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.