Friday 15 May 2015

haskell - Layout for separate 'App' and 'BackgroundJobs' packages -


I'm developing a Yesod app in which many app requests will cause data from third-party APIs. The data received will only be used during subsequent requests - that is, the API can terminate the callout turn on request without waiting to end the callout.

It is important that a certain part of the data can not be invoked by XIs twice, but the nature of the app is that many clients will often have xyz < / Code>. If I have every app thread to see if the xyz is already asked for the database, then I will start to see issues related to concurrency on a small scale too. Even if I want to write a bunch of code to handle the integrity issues related to concurrency - it's not fun, and it will be difficult to ensure that I include all the cases - in this way the expensive database queries This is bad behavior for misusing me.

I think that would be a good option to request all app threads in an AMQP queue ("Make sure XV Ease data has brought ") will be published in one or more" background worker "type processes subscriptions worldwide.

A double package layout is suggested in Greg Weber, which has 'my continuous layer' as a dependency on both the packages, he has mentioned that I make two copies of the 'permanent level' code. To avoid placing the simulink or hs-source-dir s, I can use it.

What Greg describes is a high level I understand right, but I'm relatively new to Haskell and I'm afraid that I will have to find out the information for some time. Can someone tell me in more detail for me?

  • How to keep the package directory? (Which files, in fact, constitute my continuous layer?)
  • .How do cabling files look?
  • Once they are kept in that way, do I need to change it? My (scaffolding site) source files are importing my constant models?

    The second part is: How would you write the backgroundworks process? I have never written a production haskell code in addition to the scaffold of the hood, I get it in a comprehensive framework - I will just write a main , within which I will subscribe to the message queue, and on every message, my own There will be callout / processing / storage - but I need to worry about the example while waiting for the callout to finish when the manual fork It does not block Ng process?

    Many thanks.

    I have an application that has a webapp and a different daemon process that collects data And incorporates it into that database that shares it with the webapp.

    I basically have all the code in the same source code tree and two files, which are main :: IO () , a webapp.hs and daemon.hs . I have a CAB file that is defined and two separate executables have been created.

    Unfortunately I can not share the code as an internal project in my day job.

No comments:

Post a Comment