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

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

                Author: ASF GitHub Bot
            Created on: 29/Jun/21 09:11
            Start Date: 29/Jun/21 09:11
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3634:
URL: https://github.com/apache/activemq-artemis/pull/3634#discussion_r660421342



##########
File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
##########
@@ -469,7 +474,46 @@ public void onRemoteOpen(Connection connection) throws 
Exception {
       } catch (Exception e) {
          log.error("Error init connection", e);
       }
-      if (!validateConnection(connection)) {
+
+      boolean redirected = false;
+      if (connectionCallback.getTransportConnection().getRedirectTo() != null) 
{
+         org.apache.activemq.artemis.spi.core.remoting.Connection 
transportConnection = connectionCallback.getTransportConnection();
+         BrokerBalancer brokerBalancer = 
protocolManager.getServer().getBalancerManager()
+            .getBalancer(transportConnection.getRedirectTo());
+         Target target = brokerBalancer.getTarget(transportConnection,
+            connection.getRemoteContainer(), 
handler.getSASLResult().getUser());
+
+         if (target != null) {
+            
ActiveMQServerLogger.LOGGER.redirectClientConnection(transportConnection, 
target);
+
+            if (!target.isLocal()) {
+               String host = 
ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, 
TransportConstants.DEFAULT_HOST, target.getConnector().getParams());
+               int port = 
ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 
TransportConstants.DEFAULT_PORT, target.getConnector().getParams());
+
+               ErrorCondition error = new ErrorCondition();
+               error.setCondition(ConnectionError.REDIRECT);
+               error.setDescription(String.format("Connection redirected to %s 
by broker balancer %s", brokerBalancer.getName(), target));

Review comment:
       Are the args possibly reversed? Havent tried it, but the format string 
seems to read more like the balancer name is expected to be second/last?
   
   Either way, the toString() on Target seems like this might result in 
including a bunch of config/names some might consider 'internal' to the broker 
setup into the description. Or perhaps just not entirely relevant to an AMQP 
client/user that doesnt use them. 
   
   It might be simpler and clearer just to use the target host:port, which are 
already available here.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 616051)
    Time Spent: 4h  (was: 3h 50m)

> Broker Balancers
> ----------------
>
>                 Key: ARTEMIS-3365
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3365
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>            Reporter: Domenico Francesco Bruscino
>            Assignee: Domenico Francesco Bruscino
>            Priority: Major
>          Time Spent: 4h
>  Remaining Estimate: 0h
>
> This feature adds the broker balancers to distribute the incoming client 
> connections across multiple brokers.
> It provides a native redirection for supported clients and a new management 
> API for other clients. The native redirection can be enabled per acceptor and 
> is supported only for CORE and AMQP clients.
> See the [draft 
> documentation|https://github.com/brusdev/activemq-artemis/blob/broker_balancers/docs/user-manual/en/broker-balancers.md]
>  for further details. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to