Author |
Message
|
Daniel Shaya |
Posted: Tue Jul 11, 2006 1:50 am Post subject: Transactions within mqseries |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
I'm pretty new to MQSeries so excuse me if the answer to this is trivial.
What I'd like to do is to read a number of messages off the queue and for them to be 'transactionally safe'. i.e. If my process crashes at any point before I have finished processing these events for the queue to resend them next time.
I am using the getMessage() method to get the events off the queue.
Has it got anything to do with clearMessage()? Or perhaps with the options that I pass into getMessage?
A code snippet to demonstarte would be greatly appreciated.
Thanks in advance
Daniel |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 11, 2006 2:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
It's a get message option. Look up SYNCPOINT in the manual.
There's also documentation available which explains how to syncronise units of work over multiple systems e.g. a queue manager and a database. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Daniel Shaya |
Posted: Tue Jul 11, 2006 2:38 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
Thanks
Where do I find the manual - is it online? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 11, 2006 2:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
You'll find all the manuals at:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp
I'd start with Intercommunication, then the Application Programming Guide and then Using Java (I'm guessing you're using Java). The Application Programming Reference is also useful, but only as a reference!
Enjoy your reading  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Daniel Shaya |
Posted: Tue Jul 11, 2006 3:02 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
Thanks again that was really helpful.
I wonder if you could just explain one thing.
The following is what was written about the begin() method on the MQQueueManager:
Begins a new unit of work. This method is only supported by WebSphere MQ in a bindings connection. It signals to the queue manager that a new unit of work is to begin.
What does it mean by a 'bindings connection'? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 11, 2006 3:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
"Bindings" connection means you are using only queue manager name to connect, and you are running on the same machine as your queue manager.
"Client" connection means you are using the channel, port, and hostname to connect and may or may not be running on the same machine as your queue manager. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Daniel Shaya |
Posted: Tue Jul 11, 2006 3:11 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
So does this mean that if I'm not on the same machine as my queueManager (which I would imagine to be the norm) I can't use transactions (at least not tyhe begin method).
This seems strange to me - but I'm probably missing something here. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 11, 2006 3:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes, and no.
You can not use two-phase commit (XA managed transactions) without either using bindings mode or using the MQ Extended Transactional Client. Oddly enough, the ETC is not free, but licensed at the same price as the server installation.
You can process messages in a single-phase transaction (MQ is the only involved resource) with a client connection. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jul 11, 2006 3:16 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
Daniel Shaya |
Posted: Tue Jul 11, 2006 3:20 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
To clarfiy,
In my example where I need to get a number of items off the queue in one transaction, would I be able to do this without a two phase commit. If I can do this without a 2 phase commit how would I go about doing this using the get() method?
If I do need a 2 phase commit would I have to purchase the MQ Extended Transactional Client.
Thanks once again for your help. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jul 11, 2006 3:31 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
Daniel Shaya wrote: |
If I do need a 2 phase commit would I have to purchase the MQ Extended Transactional Client. |
Why did you identify that you needed 2-phase commit for your system design?
If the app
* simply does MQPUT, MQGET, MQCMIT, and
* does not update a database, and
* is not under the control of an extenal transaction monitor, then
... you don't need MQBEGIN or the ETC for this app.
If you want to update a database "atomic"ly in your MQ transaction you'll need MQBEGIN, and the app will have to run on the same machine as the queue manager.
If you want MQ to be under the control of an external transaction monitor (eg. IBM TXSeries CICS or BEA Tuxedo), you can run remotely, but you'll need the ETC in order to do so.
Hope this clears things up  |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 11, 2006 3:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Mvic pointed you to the section on the documentation that talks about doing single-phase commit.
Fewer applications need two-phase commit than are designed to require it, in my opinion.
As I said, you can do two-phase commit with either a bindings connection or the ETC, depending on whether you want to locate a queue manager on the same machine as your application (or, really, vice-versa) or not. But either way, you pay the same license fee. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Daniel Shaya |
Posted: Tue Jul 11, 2006 5:06 am Post subject: |
|
|
Novice
Joined: 10 Jul 2006 Posts: 11
|
Thanks again for your replies - I am starting to get the picture.
I do need to update a database with the messages (which is why I want to pull off more than one at a time), and can't run the queueManager on my box. This means I need to use the ETC (that correct isn't it).
At the moment I am using the java API to MQSeries (not JMS). How do I integrate this API with the ETC? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 11, 2006 5:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
As indicated above, if you're using external resources and wish to coordinate the commit with those resources using a non-binding connection then you need the ETC.
As to integration, the Extended Transaction Client replaces the base client you're using at the moment. I believe that the only change is that to manipulate the unit of work, you'll have to code directly for the transaction coordinator rather than using MQ methods (which only work in bindings mode).
Disclaimer - I am not now nor have I ever been a Java programmer. All advice subject to correction by more skilled people!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jul 11, 2006 5:19 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
|