Effect CommunityEC
Effect Community3y ago
2 replies
Arne

Running Concurrent Event Handling with HTTP Server

Hello. I have a effect http-server and I also want to run a concurrent function/job that subscribes to events emitted by EventstoreDb all the time the http.server is listening.
pipe(
  server,
  Http.listen({ port: 3002 }),
  Effect.provideSomeLayer(fullContextTest),
  Effect.provideService(UserRepository, mockUserRepository),
  Effect.runPromise
);

const projections = UserCheckins.startEventHandling().pipe(
  Effect.provideSomeLayer(fullContextTest)
);
// I want to keep this process running as long as the HTTP server is running
Effect.runPromise(projections);
How do i keep the projections function running?
Was this page helpful?