A STAF queued message is not limited to a length of 222. You need to
understand some key concepts when submitting a STAF service request. When
an option value contains spaces (e.g. the value for the MESSAGE option),
you need to "wrap" the data (e.g. in double quotes or in a length
delimited format of :Length:) so that the STAF request parser knows when
an option value begins and ends. This is discussed in section "7.2 Option
Value Formats" in the STAF User's Guide at
http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM.
STAF provides a Java API to "wrap" an option's value (e.g. put it into a
length delimited format) that is discussed in section "3.4.1 Static Method
STAFUtil.wrapData" in the STAF Java User's Guide at
http://staf.sourceforge.net/current/STAFJava.htm#Header_wrapData. You
should use this method to for any STAF service request option values that
could contain spaces. For example:
String msg = "This is my message";
String type = "Test";
String request = "QUEUE HANDLE " + serverHandle +
" MESSAGE " + STAFUtil.wrapData(msg) +
" TYPE " + STAFUtil.wrapData(type);
handle.submit(serverIP, "QUEUE", request);
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tun Wei <wei...@gmail.com>
To: Sharon Lucas/Austin/IBM@IBMUS,
Cc: staf-users@lists.sourceforge.net
Date: 12/01/2011 07:39 AM
Subject: Re: [staf-users] Question about the STAF log
Hi Lucas:
Following my yesterday's question, I found an alternative way to let me
log message in my Java program during the remote test func running. But I
met a new problem, I believe this is a pure STAF Queue configuration
question. please help me take a look.
What I am doing is simple. I just use STAF Queue. On my Java client,
I add a java thread as STAF Queue monitor, and on my Remote Test func,
basically, I use:#
handle.submit(serverIP, "QUEUE", "queue handle "+serverHandle+" MESSAGE "
+msg+" Type Test");
Here my problem is the legth of msg. I found if the msg.legth > 222, STAF
throws following exception:
com.ibm.staf.STAFException: Invalid length delimited data specifier, '
Type Test', because its not an unsigned integer in range 0 to 4294967295
at com.ibm.staf.STAFHandle.STAFSubmit(Native Method)
at com.ibm.staf.STAFHandle.submit(STAFHandle.java:47)
at
com.informatica.pwx.semantic.stafchannel.STAFUtilities.loggingSTAFMessage(STAFUtilities.java:637)
at
com.informatica.pwx.semantic.stafchannel.STAFUtilities.runSemanticTestNGThroughSTAF(STAFUtilities.java:548)
at
com.informatica.pwx.semantic.action.SemanticRunner.atomicSematicTestsuitRun(SemanticRunner.java:95)
at
com.informatica.pwx.semantic.action.SemanticRunner.doSemantic(SemanticRunner.java:77)
at
com.informatica.pwx.semantic.action.SemanticRunner.run(SemanticRunner.java:55)
at java.lang.Thread.run(Unknown Source)
However, if msg.legth <= 222, everything is fine and my Java side can
print the message properly. So, could you please tell me if STAF Queue has
a limitation on the message passed through? Can I manually configure the
message length for the STAF Queue? (I search the online doc, but did not
find the correct information)
Finally, here is the sample message I used to try to pass into the Queue:
msg = "Trust level 5 required for the PROCESS service's START request
Requester has trust level 3 on machine MHVW7QA6L06.informatica.com
Requesting machine: tcp://mhvw7qa6l09.informatica.com (tcp://10.33.45.99)
Requesting user : none://anonymous"
Thank you very much again
Tun
On Wed, Nov 30, 2011 at 6:04 PM, wei...@gmail.com <wei...@gmail.com>
wrote:
Ok, thank you very much for the suggestions.
Sent from my HTC
----- Reply message -----
From: "Sharon Lucas" <luc...@us.ibm.com>
Date: Wed, Nov 30, 2011 17:33
Subject: [staf-users] Question about the STAF log
To: "Tun Wei" <wei...@gmail.com>
Cc: <staf-users@lists.sourceforge.net>
You are correct in the the stdout/stderr data will only be returned when
the command has completed.
In addition to the STDERRTOSTDOUT and RETURNSTDOUT options, you can
specify the STDOUT <filename> option, specifying a fully-qualified name
where the stdout/stderr file should be written on the remote machine where
your command is running (otherwise STAF will create a temporary file for
you). Then, while the command is running on the remote machine, you could
use another tool (such as "tail" if on Unix) to view the content of the
stdout/stderr file while the command is still running.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tun Wei <wei...@gmail.com>
To: Sharon Lucas/Austin/IBM@IBMUS,
Cc: staf-users@lists.sourceforge.net
Date: 11/30/2011 11:25 AM
Subject: Re: [staf-users] Question about the STAF log
Hi Sharon:
Thank you for the quick reply. I noticed the "STDERRTOSTDOUT" and tried
it. Please correct me if I am wrong. For the I found STDERRTOSTDOUT, I
can only get this output after my remote test func finished. But here, I
am hoping I can catch the output info during its running. For example,
when we run our java program, the log4j could log message at any steps of
the program running. So, is it possible for me to log information in the
STDERRTOSTDOUT during remote func running.
Thanks a lot
Tun
On Wed, Nov 30, 2011 at 4:55 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
So, via your Java program, I assume you are submitting a START request to
the STAF PROCESS service to run your test function command on a remote
server. When your test function runs, it writes output to stdout/stderr
(what you see on the screen when you run it manually). The STAF PROCESS
service allows you to redirect stdout/stderr to a file and to return this
information in the result (so that you can then do whatever you want with
this information, e.g. print it).
For example, the following PROCESS START request runs a command that
writes output to stdout/stderr, waits for it to complete, and returns the
command's stdout/stderr data in the result.
C:\>STAF local PROCESS START SHELL COMMAND "java -version" RETURNSTDOUT
STDERRTOSTDOUT WAIT
Response
--------
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data : java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
pwi32devifx-20110214 (SR
12 FP4 ))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32
j9vmwi3223ifx-2011
0208 (JIT enabled)
J9VM - 20110202_74536_lHdSMr
JIT - 20100623_16197ifx3_r8
GC - 20100211_AA)
JCL - 20110214
}
]
}
For an example of Java code that submits a similar STAF PROCESS START
request with the RETURNSTDOUT STDERRTOSTDOUT options and then accesses the
return code and the stdout/stderr data, see example 4 in section "3.1.1
Class STAFHandle" in the STAF Java User's Guide at
http://staf.sourceforge.net/current/STAFJava.htm#Header_STAFHandle.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tun Wei <wei...@gmail.com>
To: staf-users@lists.sourceforge.net,
Date: 11/30/2011 10:39 AM
Subject: [staf-users] Question about the STAF log
Hi:
I am new to STAF and I have a basic question about the STAF log.
Right now, by using Java, I can new a STAFHandle and give a request to
invoke my test function on a remote server. This part is fine.
Now I have a question about the log. Is there any way to new STAF log API
in java and catch all the information of what's happend on the remote
server? Let me explain more.
On my remote server, if I open a command-line prompt and run my test func,
there are lots of information printed line by line on the screen. But when
I invoke this test func through STAF, I can only see a black command-line
prompt opened and there is nothing printed during running. Of course, this
command-line windows disppear after the test func finsihed. So, here, I
want to catch those runtime information in my Java program. Is this
possible? (I do not want to launch another log viever to see those info. I
want to print the info in my java program)
Thank you very much for the help
Tun
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users