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/09 21:08:00 UTC

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

    [ https://issues.apache.org/jira/browse/ARTEMIS-1589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319171#comment-16319171 ] 

Johan Stenberg commented on ARTEMIS-1589:
-----------------------------------------

I can make a PR but I would like to know first if that is seen as useful extension and if so what should actually be exposed (just the container ID or the amqpConnection).

> 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 {
>   try {
>     ActiveMQProtonRemotingConnection con = (ActiveMQProtonRemotingConnection) session.getRemotingConnection();
>     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)