To configure and deploy the example, please refer to MySQL or TimesTen setup instructions. Once all the steps are completed, the following scenario can be followed to test it.
If building and deploying the example on Rhino version 2.6 and onwards, the log4j jar required in the
|
Running the example
To run the example, Telnet to the machine running Rhino, using port 9999
.
Then try these commands:
Enter: | To… |
---|---|
|
send a query using the synchronous API (if a transaction exists, it will be used) |
|
send a query using the asynchronous API (if a transactional activity exists, it will be used) |
|
start or use an existing transaction and send an update using the synchronous API |
|
start or use an existing transactional activity and send an update using the asynchronous API |
|
start or use an existing transaction and execute a stored procedure synchronously to extend the mapping with the prefix |
|
start or use an existing transactional activity and execute a stored procedure asynchronously to extend the mapping with the prefix |
|
commit the transaction |
|
rollback the transaction |
|
close the Telnet connection |
|
see brief help |
$ telnet localhost 9999 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. help COMMANDS: q-s [short] - query short code synchronously (using current transaction if one exists) q-a [short] - query short code asynchronously (using current transaction if one exists) up-s [short] [long] - update short -> long mapping synchronously (starting a transaction if needed) up-a [short] [long] - update short -> long mapping asynchronously (starting a transaction if needed) p-s [short] [prefix] - execute stored procedure synchronously to extend a mapping with the prefix (starting a transaction if needed) p-a [short] [prefix] - execute stored procedure asynchronously to extend a mapping with the prefix (starting a transaction if needed) co - commit current transaction ro - rollback current transaction close - close the telnet connection q-s 0000 Short code '0000' maps to long code '11111111111' q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on non-transactional activity Short code '0000' maps to long code '11111111111' up-s 0000 66666666666 Transaction for synchronous requests created: DatabaseTransaction[101.100003,age=0ms,conn=none] Updated mapping of short code '0000' to long code '66666666666' (There is an open transaction, it must be committed or rolled back) q-s 0000 Short code '0000' maps to long code '66666666666' (There is an open transaction, it must be committed or rolled back) ro Rolled back DatabaseTransaction[101.100003,age=9940ms,conn=DbConnectionHandle[id=4,state=CLOSED,transactional=true,connection=com.timesten.jdbc.ProxyConnection@608148fe]] q-s 0000 Short code '0000' maps to long code '11111111111' up-s 0000 555555555555 Transaction for synchronous requests created: DatabaseTransaction[101.100005,age=0ms,conn=none] Updated mapping of short code '0000' to long code '555555555555' (There is an open transaction, it must be committed or rolled back) co Committed DatabaseTransaction[101.100005,age=4698ms,conn=DbConnectionHandle[id=6,state=CLOSED,transactional=true,connection=com.timesten.jdbc.ProxyConnection@6cbd7ea6]] q-s 0000 Short code '0000' maps to long code '555555555555' q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on non-transactional activity Short code '0000' maps to long code '555555555555' up-a 0000 333333333333 Transactional activity created: DatabaseQueryActivity[101.100008],I Submitted UPDATE mappings SET long_code = '333333333333' WHERE short_code = '0000' on activity DatabaseQueryActivity[101.100008],P (There is an open transaction, it must be committed or rolled back) Updated mapping of short code '0000' to long code '333333333333' (There is an open transaction, it must be committed or rolled back) q-s 0000 Short code '0000' maps to long code '555555555555' (There is an open transaction, it must be committed or rolled back) q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on activity DatabaseQueryActivity[101.100008],P (There is an open transaction, it must be committed or rolled back) Short code '0000' maps to long code '333333333333' (There is an open transaction, it must be committed or rolled back) co Submitted commit request on transactional activity DatabaseQueryActivity[101.100008],P Transaction committed q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on non-transactional activity Short code '0000' maps to long code '333333333333' up-a 0000 44444444444 Transactional activity created: DatabaseQueryActivity[101.100011],I Submitted UPDATE mappings SET long_code = '44444444444' WHERE short_code = '0000' on activity DatabaseQueryActivity[101.100011],P (There is an open transaction, it must be committed or rolled back) Updated mapping of short code '0000' to long code '44444444444' (There is an open transaction, it must be committed or rolled back) ro Submitted rollback request on transactional activity DatabaseQueryActivity[101.100011],P Transaction rolled back q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on non-transactional activity Short code '0000' maps to long code '333333333333' p-s 0000 0 Transaction for synchronous requests created: DatabaseTransaction[101.100013,age=0ms,conn=none] Updated mapping of short code '0000' to long code '0333333333333' (There is an open transaction, it must be committed or rolled back) q-s 0000 Short code '0000' maps to long code '0333333333333' (There is an open transaction, it must be committed or rolled back) q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on non-transactional activity (There is an open transaction, it must be committed or rolled back) Short code '0000' maps to long code '333333333333' (There is an open transaction, it must be committed or rolled back) ro Rolled back DatabaseTransaction[101.100013,age=16806ms,conn=DbConnectionHandle[id=14,state=CLOSED,transactional=true,connection=com.timesten.jdbc.ProxyConnection@441e8828]] p-a 0000 00 Transactional activity created: DatabaseQueryActivity[101.100015],I Submitted CALL EXTEND_LONG_CODE_WITH_PREFIX(short_code = '0000' and prefix = '00') on activity DatabaseQueryActivity[101.100015],P (There is an open transaction, it must be committed or rolled back) Updated mapping of short code '0000' to long code '00333333333333' (There is an open transaction, it must be committed or rolled back) q-a 0000 Submitted SELECT long_code FROM mappings WHERE short_code = '0000' on activity DatabaseQueryActivity[101.100015],P (There is an open transaction, it must be committed or rolled back) Short code '0000' maps to long code '00333333333333' (There is an open transaction, it must be committed or rolled back) q-s 0000 Short code '0000' maps to long code '333333333333' (There is an open transaction, it must be committed or rolled back) co Submitted commit request on transactional activity DatabaseQueryActivity[101.100015],P Transaction committed q-s 0000 Short code '0000' maps to long code '00333333333333' close Goodbye! Connection closed by foreign host.