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 » Prefixing current timestamp to output file name.

Post new topic  Reply to topic
 Prefixing current timestamp to output file name. « View previous topic :: View next topic » 
Author Message
Cogito-Ergo-Sum
PostPosted: Thu Dec 22, 2011 7:43 pm    Post subject: Prefixing current timestamp to output file name. Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

How do I prefix the current time stamp to a file name created from FileOutput node ?

I set-up a project with a FileInput node whose Out terminal is wired to In terminal of FileOutput node. The FileOutput node is set to copy the whole file. The FileOutput node has Request properties where the values of data location, directory and file names can be provided. As per the Infocenter, these values can be ESQL expressions too.
Quote:
These properties specify the location of the data to be written, and control information that overrides the Directory and File name or pattern properties on the Basic tab. You can specify the properties on this tab as XPath or ESQL expressions. Content assist is available in the properties pane and also in the XPath Expression Builder, which you can open by using the Edit button to the right of each property.


So, for the file name, I tried variations of
Code:
esql:current_timestamp || $LocalEnvironment/Destination/File/Name

This causes a Java null pointer exception.

Code:

Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP2628E: Exception condition detected on input node 'fileCopy.FileCopyFlow.FI01'. : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/TemplateNodes/ImbCallableTemplateNode.cpp: 1863: ImbCallableTemplateNode::processMessage: ComIbmFileInputNode: fileCopy/FileCopyFlow#FCMComposite_1_1
Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP2230E: Error detected whilst processing a message in node 'fileCopy.FileCopyFlow.FO01'. : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/TemplateNodes/ImbOutputTemplateNode.cpp: 318: ImbOutputTemplateNode::processMessageAssemblyToFailure: ComIbmFileOutputNode: fileCopy/FileCopyFlow#FCMComposite_1_2
Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP4367E: The method 'sendData' in Java node 'FO01' has thrown the following exception: java.lang.NullPointerException. : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/PluginInterface/com_ibm_broker_plugin_CMbService.cpp: 1845: ImbJavaExceptionUtils::throwableToNativeException: :
Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP4395E: Java exception: 'java.lang.NullPointerException'; thrown from class name: 'com.ibm.broker.nodes.filenodes.BilingualPath', method name: 'evaluate', file: 'BilingualPath.java', line: '158' : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/PluginInterface/com_ibm_broker_plugin_CMbService.cpp: 1863: ImbJavaExceptionUtils::throwableToNativeException: :
Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP2628E: Exception condition detected on input node 'fileCopy.FileCopyFlow.FI01'. : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/TemplateNodes/ImbCallableTemplateNode.cpp: 1169: ImbCallableTemplateNode::processMessage: ComIbmFileInputNode: fileCopy/FileCopyFlow#FCMComposite_1_1
Dec 23 08:12:11 wmbhost WebSphere Broker v7001[13937]: (wmbhost.BRKR.default)[7]BIP3910I: Input node 'FI01' has retried a message the maximum number of times. The message is now propagated to the failure terminal. : wmbhost.BRKR.9ea86cb8-2e01-0000-0080-ec35aac0b0a5: /build/S700_P/src/DataFlowEngine/TemplateNodes/ImbCallableTemplateNode.cpp: 1461: ImbCallableTemplateNode::processMessage: :


Next, I tried introducing a Compute node to set the file name. In this node, I am setting the file name in the OutputLocalEnvironment using the InputLocalEnvironment and the time stamp.
Code:

SET OutputLocalEnvironment.Destination.File.Name =
         CAST (CURRENT_TIMESTAMP AS CHARACTER) || '_' || InputLocalEnvironment.Destination.File.Name ;
The value of file name in Request properties of FileOutput node was left with its default value. There is no exception and an output file is created in this case but the name is not as set in the ESQL.

I added a trace node to the Out terminal of the compute node for $LocalEnvironment and this is all I see.
Code:

( ['MQROOT' : 0xa1d64a8]
  (0x01000000:Name):Destination = (
    (0x01000000:Name):File =
  )
)

_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 22, 2011 8:02 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

When you set up your ESQL node did you set it up with propagation = Message + LocalEnvironment ?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
PostPosted: Thu Dec 22, 2011 8:55 pm    Post subject: Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

fjb_saper wrote:
When you set up your ESQL node did you set it up with propagation = Message + LocalEnvironment ?

No. It was set only to LocalEnvironment as that is where the file name exists.

I changed it to Message + LocalEnvironment. There is no exception and an output file is created in this case but the name is not as set in the ESQL.
_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Thu Dec 22, 2011 11:11 pm    Post subject: SOLVED ! Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

Using help from an earlier thread, I coded this ESQL to get it working.
Code:

BROKER SCHEMA fileCopy


CREATE COMPUTE MODULE FileCopyFlow_CO01
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      SET OutputLocalEnvironment.Destination.File.Name =
         CAST (CURRENT_TIMESTAMP AS CHARACTER FORMAT 'YYYYMMdd_HHmmss_')
            || InputLocalEnvironment.File.Name ;

      RETURN TRUE;
   END;

END MODULE;


_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Prefixing current timestamp to output file name.
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.