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
[u’ticket = 0’, u’exchange = EMPTY_STRING’, u’routing_key = EMPTY_STRING’, u’mandatory = false’, u’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
- u’ticket = 0’, u’exchange = EMPTY_STRING’, u’routing_key = EMPTY_STRING’, u’mandatory = false’, u’immediate = false’, ‘user_headers = nil’, ‘payload = “”’, ‘frame_size = nil’
1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 |
# File 'lib/amq/protocol/client.rb', line 1796 def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size) ticket = 0 buffer = @packed_indexes.dup buffer << [ticket].pack(PACK_UINT16) buffer << exchange.to_s.bytesize.chr buffer << exchange.to_s buffer << routing_key.to_s.bytesize.chr buffer << routing_key.to_s 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) if properties.nil? or properties.empty? raise RuntimeError.new("Properties can not be empty!") end properties_payload = Basic.encode_properties(payload.bytesize, properties) frames << HeaderFrame.new(properties_payload, channel) frames += self.encode_body(payload, channel, frame_size) frames end |
.has_content? ⇒ Boolean
1790 1791 1792 |
# File 'lib/amq/protocol/client.rb', line 1790 def self.has_content? true end |