[rabbitmq-discuss] Headers exchange with rabbitmq-c?
Alexis Richardson
alexis at rabbitmq.com
Mon Sep 24 15:32:32 BST 2012
On Mon, Sep 24, 2012 at 1:31 PM, Attila Nagy <bra at fsn.hu> wrote:
> Wow, this mailing list is wonderful, somehow it planted the solution into my
> mind. :)
:-)
> Here is the example -I missed the AMQP_BASIC_HEADERS_FLAG.
>
>
> amqp_table_entry_t entries[1];
> amqp_table_t table;
>
> entries[0].key = amqp_cstring_bytes("test");
> entries[0].value.kind = AMQP_FIELD_KIND_UTF8;
> entries[0].value.value.bytes = amqp_cstring_bytes("test");
>
> table.num_entries = 1;
> table.entries = entries;
> qsort(table.entries, table.num_entries, sizeof(amqp_table_entry_t),
> &amqp_table_entry_cmp);
>
> amqp_basic_properties_t props;
> props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG |
> AMQP_BASIC_DELIVERY_MODE_FLAG | AMQP_BASIC_HEADERS_FLAG;
>
> props.content_type = amqp_cstring_bytes("text/plain");
> props.delivery_mode = 2; /* persistent delivery mode */
> props.headers = table;
> amqp_basic_publish(
> self->conn,
> 1,
> amqp_cstring_bytes("test"),
> amqp_cstring_bytes(""),
> 0,
> 0,
> &props,
> amqp_cstring_bytes("test"));
>
> On 09/24/12 14:22, Attila Nagy wrote:
>>
>> So far I have tried this, without success:
>>
>> amqp_table_entry_t entries[1];
>> amqp_table_t table;
>>
>> entries[0].key = amqp_cstring_bytes("test");
>> entries[0].value.kind = AMQP_FIELD_KIND_UTF8;
>> entries[0].value.value.bytes = amqp_cstring_bytes("test");
>>
>> table.num_entries = 1;
>> table.entries = entries;
>> qsort(table.entries, table.num_entries, sizeof(amqp_table_entry_t),
>> &amqp_table_entry_cmp);
>>
>> amqp_basic_properties_t props;
>> props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG |
>> AMQP_BASIC_DELIVERY_MODE_FLAG;
>> props.content_type = amqp_cstring_bytes("text/plain");
>> props.delivery_mode = 2; /* persistent delivery mode */
>> props.headers = table;
>> amqp_basic_publish(
>> self->conn,
>> 1,
>> amqp_cstring_bytes("test"),
>> amqp_cstring_bytes(""),
>> 0,
>> 0,
>> &props,
>> amqp_cstring_bytes("test"));
>>
>> On 09/24/12 13:30, Attila Nagy wrote:
>>>
>>> Hi,
>>>
>>> I would like to use headers exchange with rabbitmq-c, but I couldn't yet
>>> find out how could I specify custom headers for a message.
>>> Could somebody help me out (and the others who asked this on the net)
>>> with an example?
>>>
>>> Thanks,
>>
>>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list