You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Johan Stenberg (JIRA)" <ji...@apache.org> on 2018/01/08 09:22:00 UTC

[jira] [Created] (ARTEMIS-1589) Make RemoteContainerId accessible via ActiveMQProtonRemotingConnection

Johan Stenberg created ARTEMIS-1589:
---------------------------------------

             Summary: Make RemoteContainerId accessible via ActiveMQProtonRemotingConnection
                 Key: ARTEMIS-1589
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1589
             Project: ActiveMQ Artemis
          Issue Type: New Feature
          Components: AMQP
    Affects Versions: 2.4.0
            Reporter: Johan Stenberg
            Priority: Minor


To access the remote containerId in an ActiveMQServerPlugin we currently have to use reflection. Something like:

{code:java}
public void afterCreateSession(final ServerSession session) throws ActiveMQException {

  ActiveMQProtonRemotingConnection con = (ActiveMQProtonRemotingConnection) session.getRemotingConnection();
  AMQPConnectionContext amqpConnection = Fields.read(con, "amqpConnection");
  String containerId = amqpConnection.getRemoteContainer();

  try {
    Field amqpConnectionField = ActiveMQProtonRemotingConnection.class.getDeclaredField("amqpConnection");
    AMQPConnectionContext amqpConnection = amqpConnectionField.get(con);
    String containerId = amqpConnection.getRemoteContainer();
  } catch (final Exception ex) {
    throw new RuntimeException(ex);
  }
}
{code}

So it would be very helpful if ActiveMQProtonRemotingConnection could be extended to provider a getter for the amqpConnection field or a getter that returns the remoteContainer ID via {{amqpConnection.getRemoteContainer()}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)