I have 2 activeMQ brokers with queues and I would like to be able to log incoming ActiveMQ message broker remote address.
After I perform pull consumer receive:
pull_consumer->receive(1000);
and after message arrives I do this:
ActiveMQConnection *amqconn = dynamic_cast<ActiveMQConnection*>(connection);
then try getting remote adress:
amqconn->getTransport().getRemoteAddress().c_str()
but its always empty
I checked for getTransport().isClosed()
and getTransport().isConnected()
and they are not closed and connected
Or is there another way to retrieve this connection information ?
It's possible that the client has a bug that prevents that value getting filled in, or that bit was never implemented in the first place. The ActiveMQ C++ client is no longer being maintained so you aren't likely to receive much if any real answer or support on that. My advice would be to move to something like a C++ client from the Apache Qpid project which use the AMQP 1.0 protocol.