You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Changes API: How to subscribe to replication conflicts?

Replication conflicts, for both documents and attachments, can be tracked using ForAllReplicationConflicts method available in changes API.


Return value
IObservableWithTask<ReplicationConflictNotification> Observable that allows to add subscriptions to notifications for all replication conflicts.


IDisposable subscription = store.Changes()
	.Subscribe(conflict =>
		if (conflict.ItemType == ReplicationConflictTypes.DocumentReplicationConflict)
			Console.WriteLine("Conflict detected for {0}. Ids of conflicted docs: {1}. " +
							  "Type of replication operation: {2}",
							  string.Join(", ", conflict.Conflicts),

Automatic document conflict resolution

In RavenDB client you have an opportunity to register conflict listeners which are used to resolve conflicted document. However this can happen only if you get the conflicted document. The ability to subscribe to the replication conflicts gives the client more power. Now if you listen to the conflicts and have any conflict listener registered, the client will automatically resolve the conflict right after the arrival of the notification.



To get more method overloads, especially the ones supporting delegates, please add Reactive Extensions package to your project.