with-open <https://clojuredocs.org/clojure.core/with-open> and spit 
<http://clojuredocs.org/clojure.core/spit> might be useful.  You could also 
rebind *out*.   That may be enough to point you in the right direction, but 
this 
page <http://clojure-doc.org/articles/cookbooks/files_and_directories.html> 
and this blog post <http://nakkaya.com/2010/06/15/clojure-io-cookbook/> 
look like they might be helpful.

On Friday, July 31, 2015 at 7:52:07 AM UTC-5, Marcin Jurczuk wrote:
>
> Hi all, 
>
> This is my first post here so please be compassionate :)
>
> I'm evaluating clojure for some of my purposes and I've stuck on task that 
> I don't know to handle.
> I have applicatin that is receiving a lot of data and writing some results 
> to a file.
> However once per hour this output file must be changes so data are in 
> chunks.
> I have working solution with writing to one file but I don't know where to 
> start code for changeing "this on the fly".
> What I need is to avoid open-close cycle with every piece of data to save 
> since data stream is big.I need only close one file and open another one 
> (name generated on some rules) where data will be continously written once 
> per hour.
>
> I have this app written in golang where there are just two goroutines and 
> main code retriving data. 
> Writing goroutine beside data to write channel also have filename channel 
> and when it receives message here it just close current file and open 
> another but file handle var (i.e outFile) is always the same.
> This file swap is made with mutex arround and other protection so there is 
> no case when write is made to a closed file.
>
> There is another timer goroutine that every ~ยง1h just calculate new 
> filename and sends message to write goroutine.
> Works like expected :)
>
> As a proof of concept I'm trying to rewrite this in clojure. 
> Summary it's like kind of syslog which have to change destination file 
> periodically. 
>
> Kind regards to everyone.
>
> Marcin.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to