WSO2 SOA Enablement Server for Java comes with an implementation of WS-ReliableMessaging (WS-RM), as detailed in WS-ReliableMessaging. Messages that are reliably delivered are grouped in sequences. Both the sequences and the messages are stored persistently in the relational database management system (RDBMS).
This tool is provided for developers of applications using WS-RM. They can use it to view stored messages and for removing messages, sequences or the whole store. Removal allows developers to start working with a clean database or, for example, to prevent undelivered messages being delivered after a code change in the product under development.
The Message Store Management Tool is launched from the MsgStoreTool script in WASP_HOME/bin. The command syntax is:
MsgStoreTool [ --option [ parameter ] ...] [command]
The full set of commands and options can be viewed in the help screen, which is called up with the command:
MsgStoreTool --help
A functional overview of the commands and options follows.
Table 39. Message Store Tool Commands
Function | Command |
---|---|
Display sequence or messages held by store. | show (default command) This command must be combined with options that specify which sequences or messages within sequences should be displayed. The --instance-name option must also be used. |
Delete sequences or messages from database tables. | delete If a sequence is deleted, all the messages it contains are also deleted. Data are specified with the same options as for the show command. The SSJ instance specified by the --instance-name option must not be running; otherwise, the command may cause failures. |
Clear all database tables from the store. | drop This operation affects all WSO2 SOA Enablement Server for Java instances that are configured to use this message store. No such instance may be running when the command is issued. The first instance that starts after this command will create a new message store. No options (except --force) may be used for this command. |
Table 40. Message Store Tool Options
Function | Option | Details |
---|---|---|
Print help screen. | --help/-h | |
Print version number and information. | --version | |
Perform command automatically without prompting user to confirm. | --force | |
Specify the instance of WSO2 SOA Enablement Server for Java that owns the data the tool is to work with. | --instance-name/-w | Normally this is specified in clientconf.xml or serverconf.xml or with the system property wasp.instance.name. This option is mandatory for show and delete commands |
Select seqences on which the command will be performed. | --for-endpoint/-e endpoint_string | Select all sequences that are input for the specified endpoint. This option cannot be used if the --output, --input or --sequence-id options are used. |
--sequence-prefix/-p string | Select only those sequences whose IDs start with the prefix. This option cannot be used if --sequence-id is used. | |
--sequence-id/-s string | Select the sequence with the specified ID (Combining this option with either --input or --output makes a request that no more than one sequence can match). This option cannot be used if --sequence-prefix or --for-endpoint is used. | |
--input/-i | Select only input sequences. Cannot be combined with the --output option. | |
--output/-o | Select only output sequences. Cannot be combined with the --input option. | |
Select messages within sequences. (May be combined with options to select sequences; otherwise, all sequences are chosen.) | --message/-m | Causes messages to be selected instead of sequences; messages belonging to sequences selected by another option are selected. This option cannot be combined with --message_number, --message-from or message-to. |
--message-number/-n positive_number | Selects the n'th message in the chosen sequence(s), where n is the parameter of the option. If this option is not combined with a sequence selecting option, the n'th message of all sequences is chosen. If the number entered in the command line is beyond the range for the sequence, nothing is selected. This option cannot be combined with --message, --message-from or message-to. | |
--message-from/-b positive_number | All messages in a sequence starting with the message number entered in the command line are selected. If this option is not combined with a sequence selecting option, it will apply to messages in all sequences. This option cannot be combined with --message or --message-number. | |
--message-to/-t positive_number | All messages in a sequence up to and including the message number entered in the command line are selected. If this option is not combined with a sequence selecting option, it will apply to messages in all sequences. This option cannot be combined with --message or --message-number. |
These examples represent some of the most common usecases of the MessageStoreTool.
Drop all tables that form the message store in a database configured with the current database.xml:
MsgStoreTool drop
Show all sequences that are only server input for an endpoint. The endpoint here is from our OneWayService reliable messaging demo:
MsgStoreTool --instance-name server --for-endpoint /demo/reliability/OneWayService
Delete all sequences on a server that begin with a particular id. In this case the id is http://wso2.com/demo/reliability/oneway/ and is again taken from our OneWayService demo:
MsgStoreTool --instance-name server --sequence-prefix http://wso2.com/demo/reliability/oneway/ delete
The Message Store Management Tool can also be invoked via Ant task.
The class name is com.idoox.wasp.tools.ant.MsgStoreTask. Note that the following packages should be in the classpath: wsrm_tools.jar, wsrm.jar, persistent_store.jar and core_tools.jar.
The task supports the following attributes: command, instanceName, forEndpoint, sequencePrefix, sequenceId, input, output, message, messageFrom and messageTo. Their meanings are the same as for command line version.
The WSO2 SOA Enablement Server for Java Administration Console, located in a running WSO2 SOA Enablement Server at http://localhost:6060/admin/console, features a Message Store Tool utility. For details, please see Message Store Tool GUI.