anchor.diff:  type ProjectedDocument = (MyCountingDoc * Raven.Json.Linq.RavenJObject * Raven.Abstractions.Data.Etag)
   
   open Raven.Json.Linq
  +
  +type objToObj = obj -> obj
  +
  +type objToSeqObjToObj = obj -> seq<objToObj>
  +
  +type UntypedDocumentProcessor = {
  +    EventTypes : seq<Type>
  +    Match: (obj -> seq<obj -> seq<objToSeqObjToObj>>)
  +    NewDocument: obj -> obj
  +}
  +
  +type DocumentHandler<'TDocument> = ('TDocument -> 'TDocument)
  +
  +type DocumentHandlerSet<'TKey, 'TDocument> = seq<('TKey * seq<DocumentHandler<'TDocument>>)>
  +
  +[<CustomComparison>]
  +[<CustomEquality>]
  +type DocumentProcessor<'TKey, 'TDocument> = {
  +    ProcessorKey : string
  +    GetDocumentKey : 'TKey -> string
  +    EventTypes : seq<Type>
  +    Match: (obj -> DocumentHandlerSet<'TKey,'TDocument>)
  +    NewDocument : 'TKey -> 'TDocument
  +}
  +with
  +    override x.Equals(y) = (match y with :? DocumentProcessor<'TKey, 'TDocument> as y -> x.ProcessorKey = y.ProcessorKey | _ -> false)
  +    override x.GetHashCode() = x.ProcessorKey.GetHashCode()
  +    interface System.IComparable with 
  +        member x.CompareTo y = x.ProcessorKey.CompareTo (y :?> DocumentProcessor<'TKey, 'TDocument>).ProcessorKey
  +
  +//with 
  +//    static member ToUntypedDocumentProcessor (x:DocumentProcessor<'TKey, 'TDocument>) =
  +//        let matchWithConversion (eventObj : obj) =
  +//            x.Match (eventObj)
  +//
  +//        let newDocumentWithConversion (key : obj) = (x.NewDocument (key :?> 'TKey)) :> obj
  +//
  +//        {
  +//            UntypedDocumentProcessor.EventTypes = x.EventTypes
  +//            Match = matchWithConversion
  +//            NewDocument = newDocumentWithConversion
  +//        }
   
   module BatchOperations =
       let buildPutCommand (writeRequest:DocumentWriteRequest) =
  
positive.code:         documentStore.Initialize() |> ignore
          documentStore
  
      [<Fact>]
      let ``Test Bulk Write`` () : unit =
          let documentStore = buildDocumentStore()
          let projector = new BulkRavenProjector(documentStore :> Raven.Client.IDocumentStore)
  
          let docKey = "MyCountingDoc/" + Guid.NewGuid().ToString()
  
          let result = 
              seq {
                  let doc = new MyCountingDoc()
                  let metadata = new Raven.Json.Linq.RavenJObject()
                  metadata.Add("Raven-Entity-Name", new RavenJValue("MyCountingDocs"))
                  let writeRequests = Seq.singleton {
                      DocumentKey = docKey
                      Document = lazy(RavenJObject.FromObject(doc))
                      Metadata = lazy(metadata)
                      Etag = Raven.Abstractions.Data.Etag.Empty }
                  yield (writeRequests, (fun _ -> async { () }))
              }
              |> BatchOperations.writeBatch documentStore 
              |> Async.RunSynchronously
  
          match result with
          | Some _ -> (true |> should equal true)
          | None -> (false |> should equal true)
  
      [<Fact>]
      let ``Pump many events at Raven`` () : unit =
          let documentStore = buildDocumentStore()
  
          let projector = new BulkRavenProjector(documentStore :> Raven.Client.IDocumentStore)
  
          let values = [1..100]
          let streams = [for i in 1 .. 1000 -> Guid.NewGuid()]
  
negative.code:         do! loop ()
      }
  
      let grouper (key, value) =
          processors
          |> Seq.collect (fun x -> 
              let matches = x.Match((key,value) :> obj) |> Seq.isEmpty |> not
              if matches then
                  (key, x) |> Seq.singleton
              else
                  Seq.empty)
          |> Set.ofSeq
  
      let queue = new WorktrackingQueue<(Guid * DocumentProcessor<Guid,CurrentDoc>), Guid * int>(grouper, processEvent, 10000, 10);
  
      member x.Enqueue key value =
         queue.Add (key,value)
  