Class: AMQ::Protocol::Basic::Publish
- Defined in:
- lib/amq/protocol/client.rb
Class Method Summary collapse
-
.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size) ⇒ Object
[“ticket = 0”, “exchange = EMPTY_STRING”, “routing_key = EMPTY_STRING”, “mandatory = false”, “immediate = false”, “user_headers = nil”, “payload = ”“”, “frame_size = nil”].
- .has_content? ⇒ Boolean
Methods inherited from Method
encode_body, index, inherited, instantiate, method_id, methods, name, split_headers
Class Method Details
.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size) ⇒ Object
- “ticket = 0”, “exchange = EMPTY_STRING”, “routing_key = EMPTY_STRING”, “mandatory = false”, “immediate = false”, “user_headers = nil”, “payload = ”“”, “frame_size = nil”
1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 |
# File 'lib/amq/protocol/client.rb', line 1656 def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size) ticket = 0 buffer = "" buffer << @packed_indexes buffer << [ticket].pack(PACK_UINT16) buffer << exchange.bytesize.chr buffer << exchange buffer << routing_key.bytesize.chr buffer << routing_key bit_buffer = 0 bit_buffer = bit_buffer | (1 << 0) if mandatory bit_buffer = bit_buffer | (1 << 1) if immediate buffer << [bit_buffer].pack(PACK_CHAR) frames = [MethodFrame.new(buffer, channel)] properties, headers = self.split_headers(user_headers) # TODO: what shall I do with the headers? if properties.nil? or properties.empty? raise RuntimeError.new("Properties can not be empty!") # TODO: or can they? end properties_payload = Basic.encode_properties(payload.bytesize, properties) frames << HeaderFrame.new(properties_payload, channel) frames + self.encode_body(payload, channel, frame_size) end |
.has_content? ⇒ Boolean
1650 1651 1652 |
# File 'lib/amq/protocol/client.rb', line 1650 def self.has_content? true end |