[rabbitmq-discuss] trying to figure out erlando

Jon Brisbin jon at jbrisbin.com
Mon May 23 14:59:00 BST 2011


Sorry to keep bugging you, but the result I get from something similar is:

r: #Fun<error_t.0.94248885>

Here's what I'm doing:

      ErrorT = error_t:new(identity_m),
      R = do([ErrorT ||
        {ok, Channel} <- amqp_connection:open_channel(AMQP),
        {ok, Response} <- return(Publish(Channel)),
        ok <- amqp_channel:close(Channel),
        Response
      ]),
      io:format("r: ~p~n", [R]),
      {reply, R, State}

I'm sure I'm not doing something right, I just don't know what it is. :/

Thanks for all the help so far, though! :)

jb


(Publish is a fun that does amqp_channel:cast(Channel, PublishCmd, Msg) and formats a response based on the result)

On May 22, 2011, at 4:36 PM, Matthew Sackman wrote:

> On Sun, May 22, 2011 at 04:29:34PM -0500, Jon Brisbin wrote:
>> 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)?
> 
> with_channel(AMQPParams, Fun) ->
>    ErrorT = error_t:new(identity_m),
>    do([ErrorT || {ok, Conn} <- amqp_connection:start(AMQPParams),
>                  {ok, Chan} <- amqp_connection:open_channel(Conn),
>                  {ok, Res}  <- return(Fun(Chan)),
>                  ok <- amqp_channel:close(Chan),
>                  Res
>       ]).
> 
> Matthew
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


Thanks!

Jon Brisbin

http://jbrisbin.com
Twitter: @j_brisbin




More information about the rabbitmq-discuss mailing list