VXG Knowledge Base

How to View Events in ActiveMQ

This article provides examples of how to view event information within ActiveMQ

Instructions

Viewing events in ActiveMQ

  1. Login to the ActiveMQ admin page.
    Eg. https://instance.mq.region.amazonaws.com:8162/admin/

  2. Navigate to the Topics page in ActiveMQ admin.

    image-20221214-162800.png
    Topics page in ActiveMQ admin
  3. Trigger an event. Afterwards an events topic should appear in the topics page.

    image-20221214-163315.png
    Topics page showing event topic
  4. To view the contents of the events topic you must create an on_message listener. The attached python script provides said listener and displays event messages. Configure the following values according to your ActiveMQ instance.

    conn = Connection(host_and_ports=[
                      ('<YOUR-ACTIVEMQ-WEB-CONSOLE-URL>', 61614)])
    
    conn.set_ssl(for_hosts=[
                 ('<YOUR-ACTIVEMQ-WEB-CONSOLE-URL>', 61614)])
    
    conn.connect('<AMQ-USERNAME>', '<AMQ-PASSWORD>', wait=True)
    
    conn.subscribe('/topic/<EVENT-TOPIC-NAME>', 'a_client_id')
    


    Example:

    conn = Connection(host_and_ports=[
                      ('x-0000xxxx-x00x-0000-0000-00000000xxx-0.mq.eu-central-1.amazonaws.com', 61614)])
    
    conn.set_ssl(for_hosts=[
                 ('x-0000xxxx-x00x-0000-0000-00000000xxx-0.mq.eu-central-1.amazonaws.com', 61614)])
    
    conn.connect('amq', 'amq123password', wait=True)
    
    conn.subscribe('/topic/cloud_events_x', 'a_client_id')
    
  5. After configuring the values, you should now be able to run the script and view topic messages when an event is triggered.

    Your ActiveMQ Topics page should now look similar to this:

    image-20221214-165251.png

    With a consumer added for your cloud_events.

    Example Output. An event "custom3" with id 26 and time 2022-12-13T02:30:00-05:00 from camera with id 1

ActiveMQ_EventsListener_v3.py