on 06-11-2012 1:56 PM
Hi,
Any suggestions on how read the date and timestamp of XI message with milliseconds as I was able to read only till second only.
But I want to capture milliseconds of the message also.
The standard Date function(CurrentDate) capable of reading till Sec only, not supporting for MilliSeconds.
The format that XI capable of : dd/MM/yyyy HH/mm/ss
Expecting Format : dd/MM/yyyy HH/mm/ss/SSS.
Appreciate Your Quick Respose......
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Praveen,
It can be achieved with the standard currenDate function available.
For Example give the format as yyyyMMddHHmmssSSS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the helps above, you'll get the "Mapping" Timestamp, and not the Message's Timestamp.
To get the Message's TimeStamp, you can use the follow code:
try {
String timestamp = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","SourceFileTimestamp");
timestamp = conf1.get(key2);
return timestamp;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
In Communication Channel, Click on Advanced tab and check the Option “SetAdapterSpecificMessageAttributes” in addition to that check the attribute that are required to be captured during run time. In our case Source File Time Stamp are required to be checked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
A simple UDF can accomplish this with the following java imports and code:
import java.util.date
import java.text.SimpleDateFormat;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH/mm/ss/SSS");
return sdf.format(new Date());
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just try mentioning dd/MM/yyyy HH/mm/ss/SSS as the target format in 'Current Date' standard function in mapping.It should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.