Do you have errors sending messages with headers?
Have you tried to use string type for key and value?
#'P_basic'{headers = [{"key", "value"}]}
Update: I examined the source code of the rabbit_common package, and I learned something about the type of headers. There are type () headers in rabbit_basic.erl:
-type(headers() :: rabbit_framing:amqp_table() | 'undefined').
And there is a type definition in the rabbit_framing_amqp module:
-type(amqp_field_type() :: 'longstr' | 'signedint' | 'decimal' | 'timestamp' | 'table' | 'byte' | 'double' | 'float' | 'long' | 'short' | 'bool' | 'binary' | 'void' | 'array'). -type(amqp_property_type() :: 'shortstr' | 'longstr' | 'octet' | 'shortint' | 'longint' | 'longlongint' | 'timestamp' | 'bit' | 'table'). -type(amqp_table() :: [{binary(), amqp_field_type(), amqp_value()}]). -type(amqp_array() :: [{amqp_field_type(), amqp_value()}]). -type(amqp_value() :: binary() | % longstr integer() | % signedint {non_neg_integer(), non_neg_integer()} | % decimal amqp_table() | amqp_array() | byte() | % byte float() | % double integer() | % long integer() | % short boolean() | % bool binary() | % binary 'undefined' | % void non_neg_integer() % timestamp ).
Thus, the header is a set of three elements (not two) that are binary, type of value, value. Therefore, you should define each heading like this:
BooleanHeader = {<<"my-boolean">>, bool, true}. StringHeader = {<<"my-string">>, longstr, <<"value">>}. IntHeader = {<<"my-int">>, long, 1000}.
source share