By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,939 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,939 IT Pros & Developers. It's quick & easy.

MQSeries based file transfers using the pymqi module

P: n/a
Hi everyone,
Has anyone developed a pymqi module based file transfer method for use
with WebSphere MQSeries v5.3?

If so, would it be possible to point me towards examples of how this was
done?

Any help that can be provided would be greatly appreciated.
Thanks
May 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Andrew Robert wrote:
Hi everyone,
Hello,
Has anyone developed a pymqi module based file transfer method for use
with WebSphere MQSeries v5.3?

If so, would it be possible to point me towards examples of how this
was done?


I'm not sure I understand your question. Webshpere MQ expects your code
to give it a stream of bytes, there's nothing file-specific in using
base WMQ so it's your application's job to read a file, put its contents
onto the desired queue, and to get it off the queue some time later.

If the code below is not what you need then feel free to ask a more
specific question :-)

import pymqi as mq

# Queue manager name
qm_name = "M01"

# Listener host and port
listener = "127.0.0.1(1414)"

# Channel to transfer data through
channel = "SYSTEM.DEF.SVRCONN"

# Input/output queue name
queue_name = "Q01"

# Make some data
file_name = "C:\\sample.txt"
sample_data = "Hello from PyMQI."
open(file_name,"w").write(sample_data)

# Connect to queue manager
qm = mq.QueueManager(None)
qm.connectTCPClient(qm_name, mq.cd(), channel, listener)

# Put a message onto the queue
queue = mq.Queue(qm, queue_name)
data = open(file_name).read()
queue.put(data)

# Close the queue, queue.put has implicitly opened the queue for output
# so we can't use the same pymqi.Queue object for getting the messages
# off the queue
queue.close()

# Now get the message, queue.get will implicitly open the queue for
# input
queue = mq.Queue(qm, queue_name)
msg = queue.get()
queue.close()

# Here's the message contents
print msg

--
Dariusz Suchojad
May 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.