[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=16322073#comment-16322073 ] ASF GitHub Bot commented on ARTEMIS-1589: - GitHub user jostbg opened a pull request: https://github.com/apache/activemq-artemis/pull/1773 ARTEMIS-1589 ActiveMQProtonRemotingConnection#getClientID() now returns remote client Id... ...instead of server client Id You can merge this pull request into a Git repository by running: $ git pull https://github.com/jostbg/activemq-artemis ARTEMIS-1589 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/1773.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1773 commit 47dd6f19c0ead5f01a526ecd941f2a32dace8f0d Author: jostbg <35264802+jostbg@...> Date: 2018-01-11T11:23:33Z ARTEMIS-1589 ActiveMQProtonRemotingConnection#getClientID() now returns remote client Id instead of server client Id > 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)
[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=16320623#comment-16320623 ] Johan Stenberg commented on ARTEMIS-1589: - Interestingly [StompConnection#getClientID()|https://github.com/apache/activemq-artemis/blob/4abca78785288092cf40d5d314eef8c528977686/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java#L431] returns the client ID set by the Stomp client but [ActiveMQProtonRemotingConnection#getClientID()|https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ActiveMQProtonRemotingConnection.java#L176] returns a server-side generated ID. So maybe the fix would be to change {code:java} @Override public String getClientID() { return amqpConnection.getContainer(); } {code} to {code:java} @Override public String getClientID() { return amqpConnection.getRemoteContainer(); } {code} WDYT? > 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)
[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)