confirm.select

48 views
Skip to first unread message

Lee Henson

unread,
Jun 3, 2011, 12:26:46 PM6/3/11
to AMQP
Hi again

I see that amq-protocol seems to have some of the pieces for
supporting publisher confirms. Is there anything more to be added to
amq-client's channel.rb other than the same sort of blocks that are
defined for transaction support? e.g.

def tx_select(&block)
@connection.send_frame(Protocol::Tx::Select.encode(@id))

self.redefine_callback :tx_select, &block
self
end # tx_select(&block)

def tx_commit(&block)
@connection.send_frame(Protocol::Tx::Commit.encode(@id))

self.redefine_callback :tx_commit, &block
self
end # tx_commit(&block)

def tx_rollback(&block)
@connection.send_frame(Protocol::Tx::Rollback.encode(@id))

self.redefine_callback :tx_rollback, &block
self
end # tx_

self.handle(Protocol::Tx::SelectOk) do |connection, frame|
channel = connection.channels[frame.channel]
channel.exec_callback(:tx_select, frame.decode_payload)
end

self.handle(Protocol::Tx::CommitOk) do |connection, frame|
channel = connection.channels[frame.channel]
channel.exec_callback(:tx_commit, frame.decode_payload)
end

self.handle(Protocol::Tx::RollbackOk) do |connection, frame|
channel = connection.channels[frame.channel]
channel.exec_callback(:tx_rollback, frame.decode_payload)
end

.... ?

Confirms work with the channel.on_return callback so there's nothing
to add there right?

Cheers
Lee

Michael Klishin

unread,
Jun 3, 2011, 12:41:25 PM6/3/11
to ruby...@googlegroups.com

Lee Henson

unread,
Jun 3, 2011, 12:59:39 PM6/3/11
to AMQP
Ah, awesome! I totally missed those.

Spasiba!

On Jun 3, 5:41 pm, Michael Klishin <michael.s.klis...@gmail.com>
wrote:
> Lee,
>
> Chanel#return is for returned messages [1]. Please see [2] and [3]. AMQP::Channel inherits from AMQ::Client::Channel.
>
> 1.https://github.com/ruby-amqp/amqp/blob/master/examples/publishing/ret...
> 2.https://github.com/ruby-amqp/amq-client/tree/master/examples/eventmac...
> 3.https://github.com/ruby-amqp/amq-client/tree/master/examples/eventmac...

Michael Klishin

unread,
Jun 3, 2011, 2:54:13 PM6/3/11
to ruby...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages