|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| Retaining a message's filename when sending it through queue | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | darioo | 
			  
				|  Posted: Thu Mar 19, 2009 3:19 am    Post subject: Retaining a message's filename when sending it through queue |   |  |  
		  | Novice
 
 
 Joined: 19 Mar 2009Posts: 15
 
 
 | 
			  
				| Greetings! I'm fairly new to MQ and MB, so please bear with me. 
 I have two machines, A and B, and I need to transfer some (small)
 files from A to B.  I'm using Message Broker for this task.  On
 A, I have set up a message flow that has two nodes:
 
 
 
   
	| Code: |  
	| FileInput -> MQOutput |  
 On B, I have another message flow:
 
 
 
   
	| Code: |  
	| MQInput -> FileOutput |  
 It's pretty obvious what I'm doing: reading a file on A, sending
 it as a message to a queue on A and transferring that message to a
 queue on B that's being read by a FileOutput node and written
 somewhere on B's file system.
 
 But I have a problem, because the file name is lost
  and I don't know how to keep it.
 
 When doing a local file transfer (FileInput -> FileOutput), the file
 name is retained and read from
 $LocalEnvironment/Destination/File/Name, but when transferring across
 machines, it's empty...
 
 I have read that there are possibilities of using reference messages
 and channel exits just by using MQ, but I'd avoid that if I can.
 Also, we can't use FTP transfer, so as you see, I don't have many
 options.
 
 It would be nice if I could do it in a straightforward way
 without using any hacks.  Putting a JavaNode in each message flow and
 then writing & reading the file name directly into the message,
 putting it somewhere in $LocalEnvironment, and deleting the file name
 afterwards is one, but very hackish and ugly possibility.
 
 Also, we're using the BLOB format, so no MRM or stuff like that...
 
 Thanks in advance for your help!
 |  |  
		  | Back to top |  |  
		  |  |  
		  | WMBDEV1 | 
			  
				|  Posted: Thu Mar 19, 2009 3:28 am    Post subject: |   |  |  
		  | Sentinel
 
 
 Joined: 05 Mar 2009Posts: 888
 Location: UK
 
 | 
			  
				| I'd add an element in an RFH2 header in Flow A to store the filename which is then read by Flow B. 
 Something like:
 SET OUTPUTROOT.MQRFH2.usr.FileName = 'Filename';
 
 will do it.
 
 
 You have to set other fields in Flow A to create a valid RFH2 header, if you do a search for MQRFH.Field you should find some useful stuff.
 
 Heres a starter for 10:
 http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac16910_.htm
 
 you dont need the psc folder though.
 
 Last edited by WMBDEV1 on Thu Mar 19, 2009 3:38 am; edited 1 time in total
 |  |  
		  | Back to top |  |  
		  |  |  
		  | MQEnthu | 
			  
				|  Posted: Thu Mar 19, 2009 3:37 am    Post subject: |   |  |  
		  |  Partisan
 
 
 Joined: 06 Oct 2008Posts: 329
 Location: India
 
 | 
			  
				| 
   
	| darioo wrote: |  
	| When doing a local file transfer (FileInput -> FileOutput), the file name is retained and read from
 $LocalEnvironment/Destination/File/Name, but when transferring across
 machines, it's empty...
 |  
 The values stored in local environment tree persist until the message flow goes out of scope..
  _________________
 -----------------------------------------------
 It is good to remember the past,
 but don't let past capture your future
 |  |  
		  | Back to top |  |  
		  |  |  
		  | mqjeff | 
			  
				|  Posted: Thu Mar 19, 2009 4:14 am    Post subject: |   |  |  
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| 
   
	| MQEnthu wrote: |  
	| 
   
	| darioo wrote: |  
	| When doing a local file transfer (FileInput -> FileOutput), the file name is retained and read from
 $LocalEnvironment/Destination/File/Name, but when transferring across
 machines, it's empty...
 |  
 The values stored in local environment tree persist until the message flow goes out of scope..
  |  
 The values stored in LocalEnvironment persist until the message flow goes out of scope OR until some Transformation node does NOT copy them to OutputLocalEnvironment, whichever comes FIRST.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | MQEnthu | 
			  
				|  Posted: Thu Mar 19, 2009 5:04 am    Post subject: |   |  |  
		  |  Partisan
 
 
 Joined: 06 Oct 2008Posts: 329
 Location: India
 
 | 
			  
				| 
   
	| mqjeff wrote: |  
	| The values stored in LocalEnvironment persist until the message flow goes out of scope OR until some Transformation node does NOT copy them to OutputLocalEnvironment, whichever comes FIRST. |  
 
   
 
 Oops!! I should have thought it while answering
  _________________
 -----------------------------------------------
 It is good to remember the past,
 but don't let past capture your future
 |  |  
		  | Back to top |  |  
		  |  |  
		  | smdavies99 | 
			  
				|  Posted: Thu Mar 19, 2009 6:34 am    Post subject: |   |  |  
		  |  Jedi Council
 
 
 Joined: 10 Feb 2003Posts: 6076
 Location: Somewhere over the Rainbow this side of Never-never land.
 
 | 
			  
				| Using the MQRFH2 usr folder is the way to go. Don't forget to setup the MQMD.format & the MQRFH2 fields correctly though otherwise it won't get read correctly.
 _________________
 WMQ User since 1999
 MQSI/WBI/WMB/'Thingy' User since 2002
 Linux user since 1995
 
 Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
 |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
  
	|    |  | Page 1 of 1 |  
 
 
  
  	| 
		
		  | 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  |  |  |