Share via


Consuming RSS and Atom Feeds

The Sync Framework Web synchronization components enable a replica to consume an RSS or Atom feed and apply feed items to its data store. Sync Framework internally represents the feed as a synchronization provider and uses other Sync Framework components to synchronize feed items between the feed provider and a provider that represents the replica. Because of this, an application only has to implement methods to convert IDs and item data from the XML format that is provided by the feed. Sync Framework takes care of the common synchronization tasks, such as detecting changes, detecting conflicts, and applying changes to the data store.

To consume a feed, an application creates a feed consumer object and provides the following items:

  • A synchronization provider that represents the replica where converted feed items will be applied.

  • ID and item converter objects.

  • A stream that contains the RSS or Atom feed to be consumed.

The application then calls the appropriate method of the feed consumer object to consume the feed. To consume the feed, Sync Framework wraps the feed in a synchronization provider and starts a synchronization session that uses the feed provider as the source provider and the local provider as the destination provider. During processing, Sync Framework calls the ID and item converters to convert IDs and item data to the format that is used by the replica. The item changes are then applied to the replica by the local provider. When processing is complete, the replica contains the items consumed from the FeedSync feed.

For more information about implementing ID and item converter objects, see Converting IDs and Items for RSS and Atom Feeds.

For more information about FeedSync feeds, see the FeedSync Web site.

Consuming the Feed by Using Managed Code

To consume a FeedSync feed, first create a FeedConsumer object by using FeedConsumer and passing it the following objects:

Then, call ConsumeFeed and pass it a Stream object that contains the RSS or Atom feed to be consumed. When processing completes, the replica contains the items consumed from this feed.

Consuming the Feed by Using Unmanaged Code

To consume a feed, first create an instance of IProducerConsumerServices by passing CLSID_FeedSyncServices and IID_IFeedProducerConsumerServices to the CoCreateInstance function. Then, create an IFeedConsumer object by using IFeedProducerConsumerServices::CreateFeedConsumer.

To consume the feed, call IFeedConsumer::ConsumeFeed and pass it the following objects:

  • An IFeedIdConverter object implemented by an application.

  • An IFeedItemConverter object implemented by an application.

  • An ISyncProvider object that represents the replica where converted feed items will be applied.

  • An IStream object that contains the RSS or Atom feed to be consumed.

When processing completes, the replica contains the items consumed from the feed that is contained in the IStream object.

See Also

Reference

IFeedProducerConsumerServices Interface
IFeedConsumer Interface
Microsoft.Synchronization.FeedSync
FeedConsumer

Concepts

Synchronizing Web Feeds
Sync Framework Web Synchronization Components