A replication sink (the entity that receives files/directories) can be configured to generate appropriate events and send it as a JMS TextMessage containing the event as an XML document to definable queues and/or topics. This is useful in situations where a file should be processed once it has arrived, for example. In that case, a simple JMS client would listen on a particular queue (or topic) and would perform particular actions (e.g. process an arrived file) on the events it receives.
Event generation is configured per replication sink. There is an entity list with name "Event Sinks". Select it and perform a right mouse click. Select "Create a new Entity":
A dialog appears where you can specify the destination, persistence mode and where you can select which type of events you like to send to that event sink:
Say, you want to get events if a file arrives at this replication sink. Such events should be send to queue "myeventqueue" and the delivery mode should be persistent to make sure the messages are still there after a reboot. This is the definition:
An event is send as a JMS TextMessage. The text is an XML document like the following example:
Example:
<?xml version="1.0" encoding="UTF-8"?>
<replication-event
event-type="deleted"
sink="sink1"
sink-path="d:/temp/testsinks/temp"
path="/"
filename="ADMINGUIDE.pdf"
is-directory="false"
modification-time="1040245494822"/>
The following table lists the attributes and their meanings:
| Attribute | Meaning |
|---|---|
| event-type | The event type. Possible values are "created", "modified", "deleted". |
| sink | The name of the replication sink. |
| sink-path | The path of the sink as specified in the replication sink configuration. |
| path | The path of the file/directory that caused the event. The path is relative to the "sink-path". A value of "/" is equal to the "sink-path" itself. The path seperator character is always "/". |
| filename | The name of the file/directory that caused the event. |
| is-directory | States whether the filename is a directory ("true") or not ("false"). |
| modification-time | The modification time of the file at the replication source. This attribute is just informational. |
Note that events are generated after the associated operation is completed. For example, an event "created" for a file is generated after the file has been completely received by the replication sink.