| Valid in: | Anywhere |
| Category: | Data Access |
| Requirement: | The JAR files for your JMS provider must be included in your CLASSPATH= environment variable. |
| Tip: | For the ActiveMQ JMS provider, you must either specify
the TIMEOUT=option or configure your jms.prefetchPolicy.queuePrefetch property
to 0.
|
CONNOPTIONS="option1=value option2=value"
CONNOPTS=
k to
the number to specify a multiple of 1024.PW=
The value does not require quotation marks if it is a valid SAS name.
msgselector="JMSPriority=5"
jms.prefetchPolicy.queuePrefetch property
is set to 0. For details about setting your prefetch property for
ActiveMQ, see ActiveMQ documentation.
The value does not require quotation marks if it is a valid SAS name.
-Djava.library.path property.
myqmgr and a destination
named myq, and that the JNDI name space
is located at \\mynode\public\jndi.
myq destination. The
TIMEOUT= option causes the underlying receive call to wait up to 100
milliseconds for a message to arrive.
data _null_;
file 'myq' device=jms
jndiiCtxtFactory='org.apache.activemq.jndi.ActiveMQInitialContextFactory'
jndiProviderURL='tcp://localhost:61616'
connfactory='ConnectionFactory'
connopts='queue.myq=myq';
put 'This is a test message';
run;
data _null_;
infile 'myq' device=jms timeout=100
jndiiCtxtFactory='org.apache.activemq.jndi.ActiveMQInitialContextFactory'
jndiProviderURL='tcp://localhost:61616'
connfactory='ConnectionFactory'
connopts='queue.myq=myq';
input mymsg $22.;
put mymsg=;
run;
—SET CLASSPATH option
on your SAS start-up command to add the JAR files.
apache-activemq-5.6.0.)filename fromweb URL
'http://www.us.apache.org/dist/activemq/apache-activemq/5.6.0/apache-activemq-5.6.0-bin.zip'
lrecl=8192 recfm=s;
data _null_;
infile fromweb;
file "&tempZipFile" recfm=n lrecl=8192;
input;
put _infile_;
run;proc groovy;
add sasjar="ANT";
submit "&tempZipFile" "&installDir";
def ant = new AntBuilder();
ant.unzip( src:args[0], dest:args[1], overwrite:"false" )
ant.delete( file:args[0] )
endsubmit;
quit;filename myq jms 'dynamicQueues/myqueue'
jndiiCtxtFactory='org.apache.activemq.jndi.ActiveMQInitialContextFactory'
jndiProviderURL='vm://broker'
connfactory='ConnectionFactory'
timeout=100;data pointofsale;
infile cards;
input saleId date e8601dt22.2 amount customerId storeId $4.;
format date e8601dt22.2 amount dollar6.2;
cards;
0001 2009-09-15T15:51:00.51 11.91 1001 A001
0002 2009-09-15T15:52:00.52 12.92 1002 B002
0003 2009-09-15T15:53:00.53 13.93 1003 A003
0004 2009-09-15T15:54:00.54 13.94 1004 A004
0005 2009-09-15T15:55:00.55 13.95 1005 A005
0006 2009-09-15T15:56:00.56 13.96 1006 A006
0007 2009-09-15T15:57:00.57 13.97 1007 A007
0008 2009-09-15T15:58:00.58 13.98 1008 A008
0009 2009-09-15T15:59:00.59 13.99 1009 A009
0010 2009-09-15T15:53:01.00 14.00 1010 A010
0011 2009-09-15T15:53:01.01 14.01 1011 A011
;
run;filename mymq JMS 'dynamicQueues/myqueue'
jndiCtxtFactory='org.apache.activemq.jndi.ActiveMQInitialContextFactory'
jndiProviderURL='vm://broker'
connFactory='ConnectionFactory'
timeout=100;
filename myXMLmap temp;
data _null_;
file myXMLmap;
infile cards;
input;
put _infile_;
cards;
<?xml version="1.0" encoding="UTF-8"?>
<SXLEMAP name="AUTO_GEN" version="2.1">
<NAMESPACES count="0"/>
<TABLE description="POINTOFSALE" name="POINTOFSALE">
<TABLE-PATH syntax="XPath">/TABLE/POINTOFSALE</TABLE-PATH>
<COLUMN name="saleId">
<PATH syntax="XPath">/TABLE/POINTOFSALE/saleId</PATH>
<TYPE>numeric</TYPE>
<DATATYPE>integer</DATATYPE>
</COLUMN>
<COLUMN name="date">
<PATH syntax="XPath">/TABLE/POINTOFSALE/date</PATH>
<TYPE>numeric</TYPE>
<DATATYPE>double</DATATYPE>
</COLUMN>
<COLUMN name="amount">
<PATH syntax="XPath">/TABLE/POINTOFSALE/amount</PATH>
<TYPE>numeric</TYPE>
<DATATYPE>double</DATATYPE>
</COLUMN>
<COLUMN name="customerId">
<PATH syntax="XPath">/TABLE/POINTOFSALE/customerId</PATH>
<TYPE>numeric</TYPE>
<DATATYPE>integer</DATATYPE>
</COLUMN>
<COLUMN name="storeId">
<PATH syntax="XPath">/TABLE/POINTOFSALE/storeId</PATH>
<TYPE>character</TYPE>
<DATATYPE>string</DATATYPE>
<LENGTH>4</LENGTH>
</COLUMN>
</TABLE>
</SXLEMAP>
;
run;filename x jms
jndiiCtxtFactory='com.sun.jndi.fscontext.RefFSContextFactory'
jndiProviderURL='file://localhost/jndi'
connfactory=MyFactory;data requests;
length name $40;
file x(myRequest) messageid=mID deliverymode=nonpersistent;
loanAmount=1000; creditScore=675; name='Brown, Bob';
put loanAmount @10 creditScore @15 name;
output;
loanAmount=2000; creditScore=500; name='Wilson, Jane';
put loanAmount @10 creditScore @15 name;
output;
loanAmount=3000; creditScore=750; name='White, William';
put loanAmount @10 creditScore @15 name;
output;
loanAmount=50000; creditScore=700; name='Jones, Fred';
put loanAmount @10 creditScore @15 name;
output;
stop;
run;data _null_;
length name $40 mID $51;
infile x(myRequest) messageid=mID length=len;
file x(myResponse) correlid=mID deliverymode=nonpersistent;
input loanAmount creditScore @;
len = len - 14;
input +1 name $varying40. len;
if ( creditScore > 600 and loanAmount < 10000 ) then
decision = 'approved';
else decision = 'declined';
put decision name;
run;data responses;
length msgName $40 cID $51;
drop msgName mID cID len;
set requests;
cID=mID;
infile x(myResponse) matchopts=correlid correlid=cID length=len;
input @1 answer $8. @;
len = len - 9;