How to read the data from MQTT Consumer from queue instead of topic

Hi
I have an ActiveMQ broker and data is coming to the queue inside this broker.

I am trying to read the data from the same broker but I am not able to read the data.

Below I have given my telegraf configuration. I have provided the topic name.
I tried creating a topic and sending custom data and that data I am able to read properly.

[[inputs.mqtt_consumer]]
  servers = ["mqtt+ssl://b-1-1.mq.ap-south-1.amazonaws.com:8883"]
  qos = 0

  ## Topics that will be subscribed to.

  topics = [

    "topic_name",

  ]
  connection_timeout = "30s"
  ## If unset, a random client ID will be generated.
   client_id = "telegraf"
  ## Username and password to connect MQTT server.
  username = "admin"
  password = "admin@123"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

[[inputs.activemq]]

  ## ActiveMQ WebConsole URL
  url = "https://b-1-1.mq.ap-south-1.amazonaws.com:8162"
  ## Required ActiveMQ Endpoint
  ##   deprecated in 1.11; use the url option
  # server = "192.168.50.10"
  # port = 8161
  ## Credentials for basic HTTP authentication
   username = "admin"
  password = "admin@123"


[[outputs.file]]

##   ## Files to write to, "stdout" is a specially handled file.

  files = ["stdout","/etc/telegraf/metrics.out"]

The data coming from devices is going to the queue, not the topic

As you can see the data is present inside the queue.
so now coming to my main question how I can read the data from the queue not from the topic using telegraf?

Hi @Ravikant_Gautam,
Hopefully, I can help you here. I believe there are three approaches you can take here. First, we need to separate the concepts; ActiveMQ is a messaging queue that does not directly translate to MQTT. From what I understand ActiveMQ has the functionality of transforming sending your queue data to an MQTT topic as you have already done.

So there are three options:

  1. You continue to move data from your queue to the MQTT broker and us subscribe via the Telegraf consumer.
  2. You can use the HTTP input plugin to trigger a read from the ActiveMQ queue: ActiveMQ
  3. You could create a small script or java app utilising the ActiveMQ library. Telegraf can then run this for you and ingest the data using the execd plugin.

I want to follow the first option but I don’t know how to push them from the queue to Topic.

I have read the data from the topic but created a custom topic and sent the data directly to the topic but in this case, I want to push the data from queue to topic and read the topic from telegraf consumer

Hi @Ravikant_Gautam,
I believe there is a config option for automatic mapping. I would have to go away and try it. I will add that to my list of tutorials to make. Does the main documentation help you here with the configuration? ActiveMQ