Try to make something like RFHUtil with Java and Blackjack.
Examples:
-
Connection configuration:
- Use default.properties:
./rfh4j.sh
(nothing else, it used by default) - Specify non default config:
./rfh4j.sh --config myconn.properties
- Use CLI:
./rfh4j.sh --hostname=mqhome.mydomain.org --port=1414 -Q DEFQM --userID=mqgod --password=123 -c JVM.DEF.SVRCONN
- Combination:
./rfh4j.sh --config myconn.properties --hostname=mqhome.mydomain.org -c JVM.DEF.SVRCONN
- Connect in binding mode:
--transport=binding
- Connect in client mode (default):
--transport=client
- Use default.properties:
-
Get messages
- Get(--srcq) and print to console(--stream) body to console
--srcq RFH.QTEST.QGENERAL1 --stream
- Get, print with wait (--wait milsec)
--srcq RFH.QTEST.QGENERAL1 --stream --wait 5000
- Get, wait and save to file(--payload) (name is msgID)
--srcq RFH.QTEST.QGENERAL1 --wait 5000 --payload /tmp/
- Get(--srcq) and print to console(--stream) body to console
-
Put message
- Put (--dstq) text (--text) message:
--dstq Q.APPLICATION_OUT --text someText
- Put file (-p, --payload) as payload:
--dstq Q.APPLICATION_OUT -p ~/myfile.xml
- Put message as redirected stream(-s, --stream)
--config default.properties --dstq Q.APPLICATION_OUT -s < ~/developer/projects/MQCluster/src/spring.xml
- Put file as payload 100 times (--times):
--dstq Q.APPLICATION_OUT -p ~/myfile.xml --times 100
- Put (--dstq) text (--text) message:
-
Activity log (MQ online monitoring)
- Listen with redirect stream:
--srcq SYSTEM.ADMIN.TRACE.ACTIVITY.QUEUE --stream --limit -1 > /tmp/online.log
- Get 50 records with spec. formatter:
--srcq SYSTEM.ADMIN.TRACE.ACTIVITY.QUEUE --stream --limit 50 --formatter=ru.codeunited.wmq.format.MQFTMAdminCommonFormatter
- Listen with redirect stream:
-
Inquiry
- Get queues status without filter (--lslq)
./rfh4j.sh --lslq
- Get queues status with filter (--lslq wildcard)
./rfh4j.sh --lslq TESTQ.*
- Get queues status without filter (--lslq)
usage: rfh4j [--all] [-c ] [--config ] [--dstq ] [--formatter ] [-h] [-H ] [--handler | -p | -s | -t ] [--limit ] [--lslq ] [-P ] [--password ] [-Q ] [--srcq ]
[--times ] [--transport ] [-u ] [-v ] [-w ]
Option description
--all Applicable to GET command
-c,--channel WMQ SVRCON channel name
--config Configuration file for WMQ connection (use it like c,H,P,Q,u)
--dstq Destination queue
--formatter Special formatter class name
-h,--help Help information
-H,--hostname WMQ QM host name or ip address (localhost is default).
--handler
--limit Limit GET command. This is maximum messages or use negative value for infinity mode
--lslq List localqueues with filter. Default value is * (means all).
-P,--port WMQ QM listener port (1414 is default).
-p,--payload File to send.
--password WMQ QM user password.
-Q,--qmanager WMQ queue manager name
-s,--stream Stream for message (std in/out).
--srcq Source queue
-t,--text Text for message.
--times Repeat count. Supported for MQPUT now.
--transport WMQ transport type
-u,--userID WMQ QM user id.
-v,--verbose Print additional output
-w,--wait Wait specified amount of time.
Usage examples:
1) Send text message to a queue (host, port, channel are default)
rfh4j.sh --dstq RFH.QTEST.QGENERAL1 -t hello!
2) Get message from a queue and print to console
rfh4j.sh --srcq RFH.QTEST.QGENERAL1 --stream
3) Get message from a queue with timeout and put to file with default name
rfh4j.sh --srcq RFH.QTEST.QGENERAL1 --wait 5000 --payload /tmp/
4) List all local queues
rfh4j.sh --lslq
5) List all local queues with filter
rfh4j.sh --lslq MYQ*