[Haskell-cafe] External system connections

Ozgun Ataman ozataman at gmail.com
Mon Jul 11 17:45:05 CEST 2011


Have you looked at Bryan O'Sullivan's resource-pool[1] library?

I've used it with MySQL, Redis and Riak connection pooling. It's been robust
and easy to use. It seems like it would be a good fit for your application.

Cheers,
Ozgun

[1] http://hackage.haskell.org/package/resource-pool

On Sun, Jul 10, 2011 at 3:04 PM, Richard Wallace <
rwallace at thewallacepack.net> wrote:

> Hello all,
>
> I'm trying to understand how to properly structure a connection to an
> external system.  I'm writing an application that processes requests
> (it's an IRC bot - ya, I've looked at lambabot but it's a bit beyond
> my current understanding and I'm really trying to learn this stuff and
> find the best way to do that is to write it myself) and sends requests
> to an external system, via SOAP.  The SOAP requests should be sent on
> separate threads.  The SOAP server requires an initial request for
> authentication be made to obtain a token used on subsequent requests.
>
> There are three ways I can structure this.  One is to do the
> authentication with the SOAP server when the application starts up and
> just use that token for all subsequent requests.  This will fall over
> if the token times out and I'd have to restart the application.
> Another way is to do authenticate with the server and get a new token
> for each request.  This is obviously really inefficient.
>
> What I'd like to do is something a bit smarter.  When a request to the
> SOAP server is to be made, if we have a token then we try and use it.
> If it fails, we reauthenticate and get a new token.  When establishing
> a new token, other threads trying to send SOAP requests should block
> until a new token is available.  There are other conditions that
> should be handled - such as an exponential back-off when the SOAP
> server can't be reached - but I feel like reestablishing the
> authentication token is really the key concern here.  Unfortunately, I
> have no idea right now how to write this in Haskell.
>
> Any pointers would be awesome.  Thanks!
>
> Rich
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110711/2283ed05/attachment.htm>


More information about the Haskell-Cafe mailing list