AMQP - application debugging

    The development of complex AMQP messaging systems requires not only debugging the code, but also understanding the structure and routing of messages.
    Sometimes it’s difficult to understand the cause of a hang or a missing message. However, the developers of RabbitMQ included in the package rabbitmq-java-client there is a class Tracer,
    which allows you to view information about the exchange in console mode.



    Tracer is an AMQP proxy that listens to the client port (5673 default) and sends them to the server port (5672 default) and vice versa, displaying information on the console.

    Installation.
    in three steps:

    We work further we look:

    //запускаем
    java -cp rabbitmq-client.jar:commons-io-1.2.jar:commons-cli-1.1.jar com.rabbitmq.tools.Tracer
    //или
    runjava.sh com.rabbitmq.tools.Tracer listenPort connectHost connectPort listenPort
    - входящий port AMQP ( default 5673)
    - connectHost - host где запущен RabbitMQ ( default localhost).
    - connectPort - порт, который слушает прокси ( default 5672).


    $cnn = new APMQConection();
    1257461452674: conn#74 ch#0 <- {#method(version-major=8,version-minor=0,server properties={product=RabbitMQ, platform=Erlang/OTP, information=Licensed under the MPL. See www.rabbitmq.com, copyright=Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd., version=1.5.4},mechanisms=PLAIN AMQPLAIN,locales=en_US),null,""}
    1257461452681: conn#74 ch#0 -> {#method(client-properties={},mechanism=PLAIN,response=guestguest,locale=en_US),null,""}
    1257461452682: conn#74 ch#0 <- {#method(channel-max=0,frame-max=131072,heartbeat=0),null,""}
    1257461452682: conn#74 ch#0 -> {#method(channel-max=0,frame-max=131072,heartbeat=0),null,""}
    1257461452683: conn#74 ch#0 -> {#method(virtual-host=/,capabilities=,insist=true),null,""}
    1257461452684: conn#74 ch#0 <- {#method(known-hosts=akalend.local:5672),null,""}
    1257461452684: conn#74 ch#1 -> {#method(out-of-band=),null,""}
    1257461452684: conn#74 ch#1 <- {#method(),null,""}

    • first column - timestamp
    • second: logical connection number
    • the third is the channel’s nomar. You can open multiple logical channels on one socket.
    • fourth: signs
      -> запрос AMQP брокеру
      <- ответ AMQP брокера
    • further go: #method - название метода open-ok { (параметры), заголовок, тело}
      (...) - параметры метода
      #contentHeader - заголовок типа basic
      тело самого сообщения


    Also popular now: