[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-03-04 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on ARTEMIS-3699:
--

Commit c376503f35cf26901088e11d7c0a9cdf35fb1967 in activemq-artemis's branch 
refs/heads/main from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=c376503 ]

ARTEMIS-3699 expose actual port on NettyAcceptor

It sometimes makes sense to set an acceptor's port to 0 to allow the JVM
to select an ephemeral port (e.g. in embedded integration tests). This
commit adds a new getter on NettyAcceptor so tests can programmtically
determine the actual port used by the acceptor.

This commit also changes the ACCEPTOR_STARTED notification and the
related logging to clarify the actual port value where clients can
connect.


> 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: 1h 20m
>  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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-03-01 Thread Robbie Gemmell (Jira)


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

Robbie Gemmell commented on ARTEMIS-3699:
-

I made a couple suggestions for changes for reliability and making it more 
widely applicable.

> 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: 20m
>  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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-03-01 Thread Robin (Jira)


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

Robin commented on ARTEMIS-3699:


Excellent! Looks good to me (y)

> 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: 10m
>  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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Justin Bertram (Jira)


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

Justin Bertram commented on ARTEMIS-3699:
-

[~Börjesson], I just sent [a 
PR|https://github.com/apache/activemq-artemis/pull/3969] to implement this. 
Please review it and let me know what you think.

> 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: 10m
>  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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Robin (Jira)


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

Robin commented on ARTEMIS-3699:


Posted before having read your reply Justin. Ok, thanks for the update. 

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Robin (Jira)


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

Robin commented on ARTEMIS-3699:


Robbie has understood my use case exactly. It is very convenient for 
integration testing.

The acceptor configuration is a Map. I would have to cast it to 
a String first and then parse it as an int. It is ugly and clunky and that is 
what I mean that there is "no easy" way. Anyways, can I be assured that this 
port is actually the one that is being used?

 

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Justin Bertram (Jira)


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

Justin Bertram commented on ARTEMIS-3699:
-

This is starting to make sense now. :) When I first read the description the 
two things (i.e. getting the acceptor config & using port 0) seemed separate, 
but it seems they are closely linked.

In short, it _is_ possible to configure an {{acceptor}} to use port {{0}}. 
However, there is currently no way to determine the value of the selected 
ephemeral port.

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Robbie Gemmell (Jira)


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

Robbie Gemmell commented on ARTEMIS-3699:
-

Does it work for the port-0 use case though, or would it simply return the 
'configured 0'? Ie the ask is for what is used, not what is configured, which 
may be different.

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Justin Bertram (Jira)


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

Justin Bertram commented on ARTEMIS-3699:
-

bq. I guess he means a way of asking what port the broker is using for an 
acceptor when armed with e.g the embedded broker instance.

This is already possible, e.g.:
{code:java}
int port = (int) 
embeddedActiveMQ.getActiveMQServer().getRemotingService().getAcceptor("myAcceptor").getConfiguration().get(TransportConstants.PORT_PROP_NAME);{java}

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Robbie Gemmell (Jira)


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

Robbie Gemmell commented on ARTEMIS-3699:
-

I guess he means a way of asking what port the broker is using for an acceptor 
when armed with e.g the embedded broker instance.

The typical case for port 0 is to allow reliably starting on a free port 
without knowing or caring what it is in advance, then determining what was 
used, and utilising that information afterwards. Tests are a frequent user of 
this pattern, enabling avoiding use of well-known ports and using random free 
ports to allow running them both alongside non-test uses of the same components 
and also different tests at the same time. The Artemis test suite tends to foul 
in both those situations as it mostly doesnt do this, which is annoying.

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)


[jira] [Commented] (ARTEMIS-3699) EmbeddedActiveMQ port configuration

2022-02-28 Thread Justin Bertram (Jira)


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

Justin Bertram commented on ARTEMIS-3699:
-

What do you mean by "there is no easy way to get the port out of the broker 
instance"?

Also, what's the use-case for starting on a random port? It would be difficult 
for clients to connect in that case.

> EmbeddedActiveMQ port configuration
> ---
>
> Key: ARTEMIS-3699
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3699
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Robin
>Priority: Minor
>
> 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)