[ 
https://issues.apache.org/jira/browse/ARTEMIS-3699?focusedWorklogId=735478&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-735478
 ]

ASF GitHub Bot logged work on ARTEMIS-3699:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Mar/22 18:19
            Start Date: 02/Mar/22 18:19
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3969:
URL: https://github.com/apache/activemq-artemis/pull/3969#discussion_r817968168



##########
File path: 
tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
##########
@@ -123,4 +124,20 @@ public void testAutoStart() throws Exception {
       assertTrue(server.getRemotingService().getAcceptor("start").isStarted());
       
assertFalse(server.getRemotingService().getAcceptor("noStart").isStarted());
    }
+
+   @Test
+   public void testActualPort() throws Exception {
+      String acceptor1Name = RandomUtil.randomString();
+      String acceptor2Name = RandomUtil.randomString();
+      String acceptor3Name = RandomUtil.randomString();
+      ActiveMQServer server = createServer(false, createDefaultInVMConfig());
+      server.getConfiguration().addAcceptorConfiguration(acceptor1Name, 
"tcp://127.0.0.1:0");
+      server.getConfiguration().addAcceptorConfiguration(acceptor2Name, 
"tcp://127.0.0.1:0");
+      server.getConfiguration().addAcceptorConfiguration(acceptor3Name, 
"tcp://127.0.0.1:61616");
+      server.start();

Review comment:
       Yep I think it will be (thats what prompted my comment about the 
volatile) so that is a good point.

##########
File path: 
tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
##########
@@ -123,4 +124,20 @@ public void testAutoStart() throws Exception {
       assertTrue(server.getRemotingService().getAcceptor("start").isStarted());
       
assertFalse(server.getRemotingService().getAcceptor("noStart").isStarted());
    }
+
+   @Test
+   public void testActualPort() throws Exception {
+      String acceptor1Name = RandomUtil.randomString();
+      String acceptor2Name = RandomUtil.randomString();
+      String acceptor3Name = RandomUtil.randomString();
+      ActiveMQServer server = createServer(false, createDefaultInVMConfig());
+      server.getConfiguration().addAcceptorConfiguration(acceptor1Name, 
"tcp://127.0.0.1:0");
+      server.getConfiguration().addAcceptorConfiguration(acceptor2Name, 
"tcp://127.0.0.1:0");
+      server.getConfiguration().addAcceptorConfiguration(acceptor3Name, 
"tcp://127.0.0.1:61616");
+      server.start();
+      
assertTrue(((NettyAcceptor)server.getRemotingService().getAcceptor(acceptor1Name)).getActualPort()
 != 0);

Review comment:
       Having to get the remoting service from the server, then the acceptor 
from that, then cast the acceptor to NettyAcceptor to then use this is still 
all a bit ugly. Even getting rid of the last bit if nothing else would be a 
decent improvement. The 'invm' acceptor seems to have an 'id' concept, could it 
return that for this and let the interface have a method?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 735478)
    Time Spent: 40m  (was: 0.5h)

> EmbeddedActiveMQ port configuration
> -----------------------------------
>
>                 Key: ARTEMIS-3699
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Robin
>            Assignee: Justin Bertram
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When creating an instance of EmbeddedActiveMQ the port that the broker binds 
> to is taken from the acceptor uri supplied to the configuration. Afterwards 
> there is no easy way to get the port out of the broker instance. In addition, 
> it would have been nice if one could provide 0 for port to have it start up 
> on a random available port. Could this be implemented?
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to