CrossClj

0.1.1 docs

SourceDocs



RECENT
    VARS
    ->Grouper
    ->Request
    body-fn
    create-thread-pool
    shutdown!
    start!
    submit!

    « Index of all namespaces of this project

    Provides asynchronous batch processing facility.
    
    (->Grouper queue pool thread notified running?)
    Positional factory function for class grouper.core.Grouper.
    
    (->Request object promise callback errback)
    Positional factory function for class grouper.core.Request.
    
    Private
    (body-fn proc-fn requests)
    Private
    (create-thread-pool size)
    (shutdown! grouper)
    Closes Grouper and waits for the completion of the submitted tasks.
    
    (start! proc-fn & {:as options})
    Creates Grouper and starts the dispatcher thread.
    
    The provided function should return a collection of return values that
    matches the number of items it processed. If it doesn't and only returns
    a single value, that value is repetedly delievered to the promises.
    
    Accepts the following options:
      :capacity - Size of request queue
      :interval - Batch processing interval
      :pool     - Number of threads or java.util.concurrent.ExecutorService instance
    (submit! grouper elem & {:keys [callback errback], :or {callback identity, errback identity}})
    Submits an item for asynchronous batch processing and returns the promise.
    
    Callback functions can be optionally specified.
      :callback
      :errback