qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dennis <jden...@redhat.com>
Subject Re: How to transfer a document like xml or txt using qpidclient?
Date Thu, 16 Jul 2009 15:36:20 GMT
On 07/15/2009 08:59 PM, aguestrush wrote:
> I want to write a client to transfer some files such as .xml to another client,there
is a example but I want a example which have a function that if I use the name of the file
as one parameter of the function,the file will be transfered.How can I use the client API
to implement this problem.

I have code that does file transfers, however I get the feeling it's
more than you might want/need. It's designed for Linux systems and
transfers all the metadata associated with a file as well as the file
contents (e.g. ownership, permissions, extended attributes, etc.). It
also is capable of transferring large files in chunks and compressing
the file contents prior to transmission and then uncompressing it upon
receipt. I can share the code if there is interest, but like I said I it
may be way more than you need.

If all you want to do is transfer a simple file of reasonable size then
it's trivial with AMQP.

On the sending side:

1) Add the filename to the application headers in the message.
2) Open the file, read it's contents into a string, set the string as
the message.

On the receive side:

1) Get the filename from the application headers
2) Open the file for writing and write the message.

Each side is about 5 lines of C++ code.

How to do C++ file IO is left as an exercise for the reader :-)

-- 
John Dennis <jdennis@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message