470,815 Members | 1,318 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

MQSeries based file transfers using the pymqi module

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
1 2206
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.

Similar topics

5 posts views Thread by | last post: by
7 posts views Thread by Limey Drink | last post: by
3 posts views Thread by Kyler Laird | last post: by
reply views Thread by ardechou | last post: by
9 posts views Thread by Andrew Robert | last post: by
1 post views Thread by nams | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.