Architecture
The inRiver connector listens to the inRiver Connect API interfaces IChannelListener and exports the entities into xml files. The files are placed into the integration folder. The Litium Studio reads these files periodically using a scheduled task. To instruct Litium Studio which file to process first, a command file is generated while exporting, which make sure for example that a parent product group is created before the product group.
Program structure
Following diagram shows the API dependancies and the data flow between different components.

When the user add or edit an entity published in the Litium Studio channel in inRiver, an event is raised from the inRiver Connect framework. The Litium.Studio.AddOns.InRiver dll has the "IChannelListener" implementation that listens to this event and uses the Litium.Studio.AddOns.Data dll to save the data into the integration file folder as xml files.
Litium.Studio.AddOns.InRiver.Integration dll starts a scheduled task in Litium Studio (This is done when through the start-up task that you configured in web.config when installing the connector to Litium Studio), that runs periodically (the importService) . When this import operation is running, it reads the data from integration folder and create/update Litium Studio entities.
Sequance diagram: EntityAdded event
Following is a sequence diagram which shows the main sequence of events when a entity is added to the LitiumStudio inRiver channel.
This whole sequence is executing inside the inRiver connect windows service.

Note: Other articles in the develop section contains more detailed information about these clases and methods presented here, and the diagram is to provide an overview of how things work together and therefore is not the complete sequence.
- The StudioConnector class (Litium.Studio.AddOns.InRiver.StudioConnector) implements the IChannelListener, IOutboundConnector and ICVLListener inRiver interfaces from the inRiver Connect API. Therefore, it is this class that sees the events from inRiver first. When you debug into the connector StudioConnector class is a good point to set break points.
- The Publisher class acts as executor of export of entities in a orderly manner, and implements all events of StudioConnector class. Publisher is a singleton class.
- The Service factory keeps a collection of classes which implements ILinkService interface, and provides the publisher with the instances of these classes, based on the behaviour of the links.
- DataService in the diagram is not a single class in the code, but a set of classes that are responsible for the format of xml data documets, saving them to disk and to loading them from the disk.
Sequence diagram: on scheduled task event to Import
Following is the sequence diagram when the periodic schedule task is executing to import items to Litium Studio.
The whole sequence is executing inside the Litium Studio process (IIS if published to IIS, or a windows service if started as a windows service for integration.)

Note: Other articles in the develop section contains more detailed information about these clases and methods presented here, and the diagram is to provide an overview of how things work together and therefore is not the complete sequence
- Import service is the Litium Studio ITask interface implementation: that is the Litium Studio scheduled task. It is this class instance that is instantiated and called by the Litium studio task scheduler.When the ITask.ExecuteTask() method is called, it simply delegates all handling of it to SyncCommandRunner.
- SyncCommandRunner is the implementation of DefaultFileImportBase class, and together with base class implementation it reads the files in the integrationFolder\SyncCommands directory on the order of file creation (first-in first-out basis). Then it deligates the actual import to one of the dataItemImport classes.
- DataItem import classes contains the actual instructions for importing item to Litium Studio. These classes are in the Import folder of the Litium.Studio.AddOns.InRiver.Integration project.