{"action":"created","issue":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/712","labels_url":"https://api.github.com/repos/EventStore/EventStore/issues/712/labels{/name}","comments_url":"https://api.github.com/repos/EventStore/EventStore/issues/712/comments","events_url":"https://api.github.com/repos/EventStore/EventStore/issues/712/events","html_url":"https://github.com/EventStore/EventStore/issues/712","id":109357788,"number":712,"title":"Projections not starting","user":{"login":"lappkast","id":3328039,"avatar_url":"https://avatars.githubusercontent.com/u/3328039?v=3","gravatar_id":"","url":"https://api.github.com/users/lappkast","html_url":"https://github.com/lappkast","followers_url":"https://api.github.com/users/lappkast/followers","following_url":"https://api.github.com/users/lappkast/following{/other_user}","gists_url":"https://api.github.com/users/lappkast/gists{/gist_id}","starred_url":"https://api.github.com/users/lappkast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lappkast/subscriptions","organizations_url":"https://api.github.com/users/lappkast/orgs","repos_url":"https://api.github.com/users/lappkast/repos","events_url":"https://api.github.com/users/lappkast/events{/privacy}","received_events_url":"https://api.github.com/users/lappkast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-01T18:36:09Z","updated_at":"2015-10-05T21:09:58Z","closed_at":null,"body":"We're trying to make projections run with the embedded event store, but it seems that projections don't properly start. I'm specifically looking for the by_category projection.\r\n\r\n``` fsharp\r\n\r\n  /// Execute f in a context where you can bind to the event store\r\n  let withEmbeddedEs f =\r\n    let node =\r\n      EmbeddedVNodeBuilder.AsSingleNode()\r\n                          .OnDefaultEndpoints()\r\n                          .RunInMemory()\r\n                          .RunProjections(ProjectionsMode.All)\r\n                          .WithWorkerThreads(16)\r\n                          .Build()\r\n\r\n    try\r\n      printfn \"starting embedded EventStore\"\r\n      node.Start()\r\n      f ()\r\n    finally\r\n      printfn \"stopping embedded EventStore\"\r\n      use stopped = new AutoResetEvent(false)\r\n      node.MainBus.Subscribe(\r\n        new AdHocHandler<SystemMessage.BecomeShutdown>(\r\n          fun m -> stopped.Set() |> ignore))\r\n      node.Stop() |> ignore\r\n      if not (stopped.WaitOne(20000)) then\r\n        Tests.failtest \"couldn't stop ES within 20000 ms\"\r\n      else\r\n        printfn \"stopped embedded EventStore\"\r\n\r\n  let withRealEs f = f ()\r\n\r\n  let withConnection factory (f : Connection -> 'a) =\r\n    factory <| fun _ ->\r\n      let conn =\r\n        ConnectionSettings.configureStart()\r\n        |> ConnectionSettings.keepReconnecting\r\n        |> ConnectionSettings.configureEnd\r\n          (Uri \"tcp://admin:changeit@localhost:1113\")\r\n          (SystemData.UserCredentials(\"admin\", \"changeit\"))\r\n      EsAction.run conn Conn.connect |> Hopac.Job.Global.run\r\n      try \r\n        let ctx =\r\n          { logger = ConsoleLogger()\r\n            ep = IPEndPoint(IPAddress.Loopback, 2113)\r\n            timeout = TimeSpan.FromSeconds 8.\r\n            creds   = SystemData.UserCredentials(\"admin\", \"changeit\") }\r\n        f conn\r\n      finally EsAction.run conn Conn.close |> Hopac.Job.Global.run\r\n\r\nlet fewTimes f =\r\n  let rec fewTimes' i =\r\n    try\r\n      f () \r\n    with e ->\r\n      if i = 100 then raise e\r\n      else\r\n        System.Threading.Thread.Sleep(200)\r\n        fewTimes' (i + 1)\r\n  fewTimes' 0\r\n\r\ntestCase \"by_category projection works\" <| fun _ ->\r\n      let event = \"\"\"{\"teen-factor\":\"high\",\"cast\":{\"Brenda\":\"Shannon Doherty\",\"Dylan\":\"Luke Perry\"}}\"\"\"\r\n      let metaBytes = Encoding.UTF8.GetBytes \"\"\"{\"director\":\"Donna's dad\",\"budget\":\"immense\"}\"\"\"\r\n      let events = Seq.ofList [EventData(Guid.NewGuid(), \"omgEvent\", true, Encoding.UTF8.GetBytes event, metaBytes)]\r\n\r\n      Impl.withConnection Impl.withEmbeddedEs <| fun conn ->\r\n        let wr =\r\n          conn.AppendToStream(\"beverlyHills-90210\", NoStream, events)\r\n          |> Job.Global.run\r\n        \r\n        fewTimes (fun _ ->\r\n          conn.ReadEvent(\"$ce-beverlyHills\", LastInStream, ResolveLinks)\r\n          |> Job.Global.run\r\n          |> fun readResult ->\r\n            if readResult.Event.HasValue then\r\n              let projectedEvent = readResult.Event.Value.OriginalEvent.Data |> Encoding.UTF8.GetString\r\n              Assert.Equal(\"should have projected event\", projectedEvent, event)\r\n            else\r\n              Tests.failtest (sprintf \"No event result returned %O\" readResult.Status))\r\n```\r\n\r\nThe wrapped API looks like this:\r\n\r\n``` fsharp\r\n          member x.ReadEvent(stream, eventVersion, resolveLinks) =\r\n            let (EventVersion eventVersion) = eventVersion\r\n            y.ReadEventAsync(stream, eventVersion,\r\n                             (match resolveLinks with ResolveLinks r -> r),\r\n                             creds)\r\n            |> Task.awaitJob\r\n```\r\n\r\nThe call to `conn.ReadEvent(\"$ce-beverlyHills\", LastInStream, ResolveLinks)` never returns any data – it seems projections are not starting."},"comment":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/comments/145669281","html_url":"https://github.com/EventStore/EventStore/issues/712#issuecomment-145669281","issue_url":"https://api.github.com/repos/EventStore/EventStore/issues/712","id":145669281,"user":{"login":"lappkast","id":3328039,"avatar_url":"https://avatars.githubusercontent.com/u/3328039?v=3","gravatar_id":"","url":"https://api.github.com/users/lappkast","html_url":"https://github.com/lappkast","followers_url":"https://api.github.com/users/lappkast/followers","following_url":"https://api.github.com/users/lappkast/following{/other_user}","gists_url":"https://api.github.com/users/lappkast/gists{/gist_id}","starred_url":"https://api.github.com/users/lappkast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lappkast/subscriptions","organizations_url":"https://api.github.com/users/lappkast/orgs","repos_url":"https://api.github.com/users/lappkast/repos","events_url":"https://api.github.com/users/lappkast/events{/privacy}","received_events_url":"https://api.github.com/users/lappkast/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T21:09:58Z","updated_at":"2015-10-05T21:09:58Z","body":"```\r\n$curl -i http://localhost:2113/projections/any\r\nHTTP/1.1 500 Internal Server Error\r\nServer: Mono-HTTPAPI/1.0\r\nDate: Mon, 05 Oct 2015 21:08:53 GMT\r\nContent-Length: 0\r\nConnection: close\r\n```"}}