Harish  Muleva
Harish Muleva

Reputation: 11

RabbitMQ get queue data does not add header data. any idea how to get it

rabbitmqadmin get queue=test requeue=false print below response

+-------------+----------+---------------+--------------+------------------+-------------+  
| routing_key | exchange | message_count |   payload    | payload_encoding | redelivered |  
+-------------+----------+---------------+--------------+------------------+-------------+  
| test        |          | 0             | hello, world | string           | False       |  
+-------------+----------+---------------+--------------+------------------+-------------+

I want to get header as one more columns and its value.

How I can get it header value in the above table. If not possible in the same table then how to get it in other table. I want to publish my header data also with response data

Upvotes: 1

Views: 1222

Answers (1)

marmar84
marmar84

Reputation: 11

Just use --depth.

Example without --depth: rabbitmqadmin get queue=smsc01 requeue=true count=10

Result without headers:

> +-------------+----------+---------------+---------+---------------+------------------+-------------+
> | routing_key | exchange | message_count | payload | payload_bytes | payload_encoding | redelivered |
> +-------------+----------+---------------+---------+---------------+------------------+-------------+
> | empty       | smsc-ex  | 4             | empty1  | 6             | string           | True        |
> | empty       | smsc-ex  | 3             | empty2  | 6             | string           | True        |
> | empty       | smsc-ex  | 2             | empty3  | 6             | string           | True        |
> | empty       | smsc-ex  | 1             | empty3  | 6             | string           | True        |
> | empty       | smsc-ex  | 0             | empty4  | 6             | string           | True        |
> +-------------+----------+---------------+---------+---------------+------------------+-------------+

Example with --depth: rabbitmqadmin get queue=smsc01 requeue=true count=10 --depth=4

Result with headers:

> +-------------+----------+---------------+---------+---------------+------------------+--------------------------+---------------------------+-------------+
> | routing_key | exchange | message_count | payload | payload_bytes | payload_encoding | properties.delivery_mode | properties.headers.msisdn | redelivered |
> +-------------+----------+---------------+---------+---------------+------------------+--------------------------+---------------------------+-------------+
> | empty       | smsc-ex  | 4             | empty1  | 6             | string           | 2                        |                           | True        |
> | empty       | smsc-ex  | 3             | empty2  | 6             | string           | 2                        |                           | True        |
> | empty       | smsc-ex  | 2             | empty3  | 6             | string           | 2                        |                           | True        |
> | empty       | smsc-ex  | 1             | empty3  | 6             | string           | 2                        |                           | True        |
> | empty       | smsc-ex  | 0             | empty4  | 6             | string           | 2                        | 48654987321               | True        |
> +-------------+----------+---------------+---------+---------------+------------------+--------------------------+---------------------------+-------------+

Upvotes: 1

Related Questions