lib/bunny/session.rb in bunny-0.9.0.pre1 vs lib/bunny/session.rb in bunny-0.9.0.pre2
- old
+ new
@@ -42,11 +42,11 @@
#
# API
#
- attr_reader :status, :host, :port, :heartbeat, :user, :pass, :vhost, :frame_max, :default_channel
+ attr_reader :status, :host, :port, :heartbeat, :user, :pass, :vhost, :frame_max
attr_reader :server_capabilities, :server_properties, :server_authentication_mechanisms, :server_locales
attr_reader :default_channel
attr_reader :channel_id_allocator
def initialize(connection_string_or_opts = Hash.new, optz = Hash.new)
@@ -103,15 +103,10 @@
def channel0
@channel0
end
- def channel
- @default_channel
- end
-
-
def start
@status = :connecting
self.initialize_transport
@@ -131,10 +126,11 @@
ch = Bunny::Channel.new(self, n)
ch.open
ch
end
end
+ alias channel create_channel
def close
if @transport.open?
close_all_channels
@@ -169,11 +165,41 @@
def prefetch(prefetch_count)
self.basic_qos(prefetch_count, true)
end
+
#
+ # Backwards compatibility
+ #
+
+ def queue(*args)
+ @default_channel.queue(*args)
+ end
+
+ def direct(*args)
+ @default_channel.direct(*args)
+ end
+
+ def fanout(*args)
+ @default_channel.fanout(*args)
+ end
+
+ def topic(*args)
+ @default_channel.topic(*args)
+ end
+
+ def headers(*args)
+ @default_channel.headers(*args)
+ end
+
+ def exchange(*args)
+ @default_channel.exchange(*args)
+ end
+
+
+ #
# Implementation
#
def open_channel(ch)
@@ -384,13 +410,9 @@
@transport.flush
end
end # send_frameset(frames)
protected
-
- def socket_open?
- !@socket.nil? && !@socket.closed?
- end
def init_connection
self.send_preamble
connection_start = @transport.read_next_frame.decode_payload