|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
open/close queue |
« View previous topic :: View next topic » |
Author |
Message
|
emaster |
Posted: Thu May 02, 2002 5:54 am Post subject: |
|
|
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 |
|
 |
PeterPotkay |
Posted: Thu May 02, 2002 8:28 am Post subject: |
|
|
 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 |
|
 |
emaster |
Posted: Thu May 02, 2002 9:16 am Post subject: |
|
|
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 |
|
 |
bduncan |
Posted: Thu May 02, 2002 9:53 am Post subject: |
|
|
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 |
|
 |
emaster |
Posted: Thu May 02, 2002 10:30 am Post subject: |
|
|
Novice
Joined: 15 Apr 2002 Posts: 10
|
Thank you very much that is what I needed to know. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|