ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB Create folders?

Post new topic  Reply to topic
 WMB Create folders? « View previous topic :: View next topic » 
Author Message
bdaoust
PostPosted: Wed Sep 26, 2012 11:44 am    Post subject: WMB Create folders? Reply with quote

Centurion

Joined: 23 Sep 2010
Posts: 130

Hello everyone:

I'm pretty new to the message broker development world and was wondering if WMB has the ability to create folders on a shared network drive. Ideally, the name of the folder would come from a value within the incoming XML file.

Does anyone have an example they can share?

Thank you,
-Brian

Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Sep 26, 2012 12:04 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Hi Brian.

Yes, WMB can do this. WMB is a container, and operates a number of languages in the container much like WAS or Tomcat are containers.

To create a folder on a network drive from WMB, first verify that the system you are using has ability to access the network share and that the WMB Service Id has authority to write to that directory (WMB service Ids should never be 'mqm').

Next create a Java compute node that has the following:

Code:
import java.io.*;

 public void createdir()
  {
  try{
  String strDirectoy ="test";
  String strManyDirectories="dir1/dir2/dir3";

  // Create one directory
  boolean success = (
  new File(strDirectoy)).mkdir();
  if (success) {
  System.out.println("Directory: "
   + strDirectoy + " created");
  } 
  // Create multiple directories
  success = (new File(strManyDirectories)).mkdirs();
  if (success) {
  System.out.println("Directories: "
   + strManyDirectories + " created");
  }

  }catch (Exception e){//Catch exception if any
  System.err.println("Error: " + e.getMessage());
  }
  }


Good luck.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Sep 26, 2012 12:27 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lancelotlinc wrote:
Next create a Java compute node that has the following:


Or get the FileOutput node to do it for you with 1 line of ESQL.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Sep 26, 2012 11:28 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Vitor wrote:


Or get the FileOutput node to do it for you with 1 line of ESQL.


By the way, FileOutput cannot create a folder on a remote FTP server. Does anyone know if this has been fixed? I made a PMR for a customer a year or two ago but I'm under the impression that nothing was done.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Sep 26, 2012 11:57 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

What was the APAR number assigned to the problem by IBM?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 27, 2012 5:20 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Esa wrote:
By the way, FileOutput cannot create a folder on a remote FTP server.


Quite so, but the OP was talking about a shared drive.

Esa wrote:
Does anyone know if this has been fixed? I made a PMR for a customer a year or two ago but I'm under the impression that nothing was done.


You would be best advised to look up the PMR number. As I indicate above, my belief is that it still doesn't work.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Thu Sep 27, 2012 8:17 pm    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Hi Vitor,

Could you share the link to the documentation that describes how to implement this with FileOutput node? I tried to find it from InfoCenter with no luck. Perhaps it was just because of my inability to use right keywords.

Vitor wrote:
lancelotlinc wrote:
Next create a Java compute node that has the following:


Or get the FileOutput node to do it for you with 1 line of ESQL.


--
Marko
Back to top
View user's profile Send private message Visit poster's website
Esa
PostPosted: Thu Sep 27, 2012 11:24 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

marko.pitkanen wrote:

Could you share the link to the documentation that describes how to implement this with FileOutput node?


Marko, I think Vitor just means the one line you need for overriding $LocalEnvironment/Destination/File/Directory

Of course you will have to write a file in the directory, too, for this to work.

zpat wrote:
What was the APAR number assigned to the problem by IBM?

I'm not working at that client any more. I asked them for the PRM number but they have not replied.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Sep 28, 2012 5:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Esa wrote:
marko.pitkanen wrote:

Could you share the link to the documentation that describes how to implement this with FileOutput node?


Marko, I think Vitor just means the one line you need for overriding $LocalEnvironment/Destination/File/Directory




Esa wrote:
Of course you will have to write a file in the directory, too, for this to work.




I made the simplifying assumption that if you're not writing a file to it, you don't care much if the directory's there or not.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Sep 28, 2012 5:55 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Thanks,

What I'm missing is that I can't find documentation of this behaviour. Can someone point me the document? For example Using local environment variables with file nodes document doesn't describe it?

--
Marko
Back to top
View user's profile Send private message Visit poster's website
Esa
PostPosted: Fri Sep 28, 2012 6:36 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

marko.pitkanen wrote:
Thanks,

What I'm missing is that I can't find documentation of this behaviour. Can someone point me the document? For example Using local environment variables with file nodes document doesn't describe it?


Yes it does, paragraph LocalEnvironment.Destination.File fields. So basicly you just
Code:
SET InputLocalEnvironment.Destination.File.Directory = '<some directory path>';


But if for example the input message already contains the directory path, you do not need to copy it to LocalEnvironment, you just set the FileOutput node property Request directory property location to point to the correct field as documented in FileOutput node documentation.

What may have confused you is that I copied the path from FileOutput node documentation where Request directory property location uses slash as path separator. I should have put it this way:


Marko, I think Vitor just means the one line you need for setting LocalEnvironment.Destination.File.Directory
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Sep 28, 2012 6:53 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Thanks Esa,

I must need either new brains or glasses ;-) but where does it say that by setting this LocalEnvironment.Destination.File.Directory -variable FileOutput node will create the folder to file system if it doesn't exist already?

--
Marko
Back to top
View user's profile Send private message Visit poster's website
marko.pitkanen
PostPosted: Fri Sep 28, 2012 11:13 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Yes,

I tested and it works with 6.1 and 7 ;-)

Code:
SET OutputLocalEnvironment.Destination.File.Directory = '/home/xx/filenode/test';
SET OutputLocalEnvironment.Destination.File.Name = 'test.txt';
where  folder structure .../filenode/test didn't exist before writing test.txt with File Output node

does the trick.

--
Marko
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB Create folders?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.