Producing RSS and Atom Feeds

The Sync Framework Web synchronization components enable a replica to publish its data to interested subscribers as an RSS or Atom feed. The Web synchronization components internally represent the feed as a synchronization provider and use 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 to the XML format that is expected by the feed. Sync Framework takes care of the common synchronization tasks, such as detecting changes, detecting conflicts, and applying changes to the produced feed.

To produce a feed, an application creates a feed producer object and provides the following items:

  • A synchronization provider that represents the replica to be produced.

  • ID and item converter objects.

  • A stream that contains an empty RSS or Atom feed.

The application then calls the appropriate method of the feed producer object to produce the feed. To produce the feed, Sync Framework wraps the feed in a synchronization provider and starts a synchronization session that uses the local provider as the source provider and the feed provider as the destination provider. During processing, Sync Framework calls the ID and item converters to convert IDs and item data to valid XML format, and then inserts the XML data into the appropriate location in the stream. When processing is complete, the stream feed contains the items from the replica together with FeedSync metadata about them. This stream can then be published to feed subscribers by using an appropriate mechanism.

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.

Producing the Feed by Using Managed Code

To produce a feed, first create a FeedProducer object by using #ctor(KnowledgeSyncProvider, FeedIdConverter, FeedItemConverter) and passing it the following objects:

Then, call ProduceFeed(Stream) and pass it a Stream object that contains an empty RSS or Atom feed. When processing completes, this Stream object contains a FeedSync feed that contains the items from the replica. Be aware that the stream must be opened with read and write access.

To produce a partial feed, pass an EndpointState object to ProduceFeed(Stream). This establishes a baseline for an incremental feed that contains all replica items that are not contained in the baseline.

Producing the Feed by Using Unmanaged Code

To produce a feed, first create an IFeedProducerConsumerServices object by passing CLSID_FeedSyncServices and IID_IFeedProducerConsumerServices to the CoCreateInstance function. Then, create an IFeedProducer object by using IFeedProducerConsumerServices::CreateFeedProducer.

To produce the feed, call IFeedProducer::ProduceFeed 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 to be produced.

  • An IStream object that contains an empty RSS or Atom feed. Be aware that the stream must be opened with read and write access.

When processing completes, the IStream object contains a FeedSync feed that contains the items from the replica.

To produce a partial feed, pass an IEndpointState object to IFeedProducer::ProduceFeed. This establishes a baseline for an incremental feed that contains all replica items not contained in the baseline.

请参阅

参考

Microsoft.Synchronization.FeedSync

FeedProducer

EndpointState

其他资源

Synchronizing Web Feeds

Sync Framework Web Synchronization Components

IFeedProducerConsumerServices interface

IFeedProducer interface

IEndpointState interface