Question regarding commit/backout of a message using the pymqi module

JonS jon.stephan at gmail.com
Thu Jul 20 11:45:34 EDT 2006


Andrew Robert wrote:
> Hi everyone,
>
> Could someone help explain what I am doing wrong in
> this code block?
>
> This code block is an excerpt from a larger file that receives
> transmitted files via IBM WebSphere MQSeries an drops it to the local
> file system.
>
> Transmission of the file works as designed but it has a flaw.
>
> If the file cannot be created for whatever reason, the transmitted
> message is lost.
>
> What I am trying to do is ensure that a file transmit is considered
> successful only after the created file's checksum matches.
>
> If not, the code should treat it as an error and roll back the message
> to MQSeries without a commit.
>
> The basis for this should be around the pymqi.QueueManager class which
> is named mq in the block listed below.
>
> pymqi.MQMIError: MQI Error. Comp: 1, Reason 2121: WARNING:
> MQRC_NO_EXTERNAL_PARTICIPANTS
> Do you have any idea why this might be occurring?
>
> 	Connect to queue manager
> 	"""
>         try:
> 	    self.qm = mq.QueueManager(options.qmanager.upper() )
> 	    self.qm.begin()
> 	except mq.PYIFError, err:
>             mqevlog.event("error",err)
> 	    sys.exit(1)
>
> 	queue = mq.Queue(self.qm, self.queue_name)
>         pmo = mq.pmo(Options = CMQC.MQPMO_SYNCPOINT)
>         md = mq.md()
> Any help/insight you can provide on this would be greatly appreciated.
(edited)

Andrew
Don't know if you still need help with the above. I am new to Python
and was searching for MQ interfaces with Python and found your
question. Having some coding (C) experience with MQ Series it appears
that you are performing a local unit of work coodinated by the Queue
Manager only. In this scenario you do not specify the mqbegin as it
implies an external resource manager will be involved. Under your PMOs
you have specified the messages are to be extracted under syncpoint
control which is all you need. The messages should be remain in the
queue if there is an mqback call or the application ends without a
disconnect. In my experience while the messages are preserved in the
queue any partial file write to the OS will be left after the backout
(in the case of space issues). Your code will have to do the
housekeeping. 

best regards,
-JonS




More information about the Python-list mailing list