[rabbitmq-discuss] trying to figure out erlando

Jon Brisbin jon at jbrisbin.com
Sun May 22 22:29:34 BST 2011


Building on this, how do I translate what's in the blog post w.r.t. error_m so I get the behaviour of always doing an amqp_channel:close(Chan) no matter what happens in my publish step (right after the open_channel)?

jb


----- Original Message -----
From: "Matthew Sackman" <matthew at rabbitmq.com>
To: rabbitmq-discuss at lists.rabbitmq.com
Sent: Sunday, May 22, 2011 6:25:58 AM
Subject: Re: [rabbitmq-discuss] trying to figure out erlando

On Sat, May 21, 2011 at 03:35:58PM -0500, Jon Brisbin wrote:
> I'm digging through the blog post on Erlando and it seems there's some
> changes in Erlando recently w.r.t. the error monad. It seems to be
> called "error_t" now and looks like it works similarly to state_t. Is
> that correct?

Yes.

> At any rate, I'm still missing something because I can't seem to
> figure how to use this in the context of the erlang amqp client.
> 
> I'm basically trying to do a maybe on getting a channel so I don't
> have to do:
> 
> case amqp_connection:start(network, AMQPParams) of
>   {ok, Conn} -> case amqp_connection:open_channel(AMQP) of
>     {ok, Channel} -> % do some work
>   end
> end
> 
> and so on and so forth...
> 
> How would I use Erlando for this?

ErrorT = error_t:new(identity_m),
do([ErrorT || {ok, Conn} <- amqp_connection:start(AMQPParams),
              {ok, Chan} <- amqp_connection:open_channel(Conn),
              etc
   ]).

Matthew
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list