When creating an Event, the SyncEventFactory requires an event context. Where does the event context come from and how do I set it?
First, there are a few predefined event context classes that can be used
- SyncUnitContext - Context container for a SyncUnit. This will be created by the SyncEventFactory if supplying a SyncUnit as the context object.
- ErrorContext (interface) - An instance of the ErrorContext is created by the SyncEventFactory when calling createSyncErrorEvent
- ProgressContext (interface) - concrete implementation is SyncUnitProgress
When creating a sync event indicating state (STARTED, COMPLETED, etc.), generally you will want to pass the SyncUnit as the context object. When creating a sync event indicating progress, pass a class implementing ProgressContext. When creating an error event, the SyncEventFactory creates the context for you based upon the parameters passed (the error message).
Parent topic: Generating events: XPD622