SendEvent Utility
From RuleCore Support
Contents |
Description
The SendEventAMQ utility is used to generate and send ruleCore events to an ActiveMQ JMS queue. The utility may be downloaded from here (source).
Running SendEventAMQ
Prerequisites
The com.rulecore.sendevent.amq.SendEventAMQ class requires a few external jars to function and to be available on the CLASSPATH;
- Apache ActiveMQ v4 runtime package (
apache-activemq-4.x.x.jar). Download it from The Apache ActiveMQ site. - JSAP command line parser package, version 2.1 (JSAP-2.1.jar). Download it from the Martian Software site.
Parameters
The table below lists all available command line options.
| Parameter | Value range | Default | Description |
| --brokerurl/-b | URL | tcp://localhost:61616 | URL specifying address of ActiveMQ JMS broker. |
| --queue/-q | String | Mandatory, no default value. | Name of ActiveMQ queue |
| --count/-c | Integer > 0 | 1 | Number of events to send. |
| --eventtype/-e | Alphanumeric string. | Empty string. | Name of event type to send. This is the name of the event root element. Ignored if the --wholeevent option is specified.
|
| --eventclass/-l | system | user | Name of event class. Assigned to the eventClass attribute. Ignored if the --wholeevent option is specified.
|
| --subscription/-s | UUID | No default. | Subscription ID. Ignored if the --wholeevent option is specfied.
|
| --timestamp/-t | ISO 8601 timestamp | Defaults to now. | The event timestamp. Assigned to the eventTimestamp attribute. |
| --causedby | index,event type,event id (integer, alphanumeric string, UUID) | Empty string. | The event that caused this event to happen. Ends up in the causedBy section. |
| --interval/-i | Float > 0.0 | 1.0 | Generate a new event every X seconds. Used when event count > 1. |
| --deviation/-v | Float, 0.0 < interval | 0.0 | The elapsed time between generated events may vary from the specified interval with this amount. |
| --file/-f | Pathname | No default. | File containing the event data. Parameter may not be combined with the --generate option. If the --wholeevent option is specified, the file contains the whole event. If false, it contains only the event body.
|
| --wholeevent/-w | Boolean | False | If specified, the contents of the file specified by --file is sent as the event message.
|
| --rewriteheader/-r | Boolean | False | Relevant only if the --wholeevent option is specified, this option toggles a rewrite of the eventId and eventTimestamp attributes of the event XML. The eventId will be generated anew and the eventTime will either be set to the value of the --timestamp option or set to the current time.
|
| --generate/-g | Boolean | False | If specified, generate event with the properties given above (type, class, timestamp, subscription ID, body). |
Examples
To generate and send a ProcessStatus event to the local ActiveMQ JMS queue rc.input1 , the following command line may be used:
./send_event_amq.sh --queue=rc.input1 --generate --subscription=ab02e24d-ccc3-4250-902b-3bf0719fa18f --eventtype=ProcessStatus
To generate and send 1000 Ping events to the local ActiveMQ JMS queue rc.input1, at a rate of 2 events/sec, the following command line may be used:
./send_event_amq.sh --queue=rc.input1 --generate --subscription=ab02e24d-ccc3-4250-902b-3bf0719fa18f --interval=0.5 --count=1000 --eventtype=Ping
To generate an ActionDone event to the local ActiveMQ JMS queue rc.input1, using an event body from file /home/rulecore/eventbody.xml, and a timestamp of 2008-04-01T10:00Z the following command line may be used:
./send_event_amq.sh --queue=rc.input1 --generate --subscription=ab02e24d-ccc3-4250-902b-3bf0719fa18f --timestamp="2008-04-01T10:00Z" --eventtype=ActionDone --file=/home/rulecore/eventbody.xml
To send a GPSLocation event to the remove ActiveMQ JMS queue rc.input1 at host demo1.rulecore.com, using an event file /home/rulecore/gpslocation1.xml and a timestamp of now, the following command line may be used:
./send_event_amq.sh --brokerurl tcp://demo1.rulecore.com:61616 --queue=rc.input1 --rewriteheader --wholeevent --subscription=ab02e24d-ccc3-4250-902b-3bf0719fa18f --file=/home/rulecore/gpslocation1.xml