activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Stenberg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1589) Make RemoteContainerId accessible via ActiveMQProtonRemotingConnection
Date Wed, 10 Jan 2018 16:50:00 GMT

    [ 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)

Mime
View raw message