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

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

                Author: ASF GitHub Bot
            Created on: 23/May/24 09:45
            Start Date: 23/May/24 09:45
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #4941:
URL: https://github.com/apache/activemq-artemis/pull/4941#discussion_r1611299971


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java:
##########
@@ -701,7 +745,11 @@ private void connectSender(Queue queue,
             sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
             sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);
             Target target = new Target();
-            target.setAddress(targetName);
+            if (targetAddress != null && !targetAddress.isBlank()) {
+               target.setAddress(targetAddress);

Review Comment:
   This targetName / targetAddress distinction is a bit awkard with both around 
given that 'target address' is usually the normal terminology and what the 
value actually sets. Perhaps change the prior one to targetAddress instead of 
targetName, then use targetAddressOverride for the new 'use this instead' value 
to clarify things?
   
   Similarly for the receiver bit above.
   
   EDIT: or see other comment, simplify this and move decision to the call site 
where config is being pulled originally.



##########
artemis-server/src/main/resources/schema/artemis-configuration.xsd:
##########
@@ -2228,6 +2228,50 @@
       </xsd:attribute>
    </xsd:complexType>
 
+   <xsd:complexType name="amqp-broker-connect-sender-type">
+      <xsd:complexContent>
+         <xsd:extension base="amqp-address-match-type">
+            <xsd:attribute name="target-address" type="xsd:string" 
use="optional">
+               <xsd:annotation>
+                  <xsd:documentation>
+                     This address to assign to the AMQP sender link Target.

Review Comment:
   This -> The? Similarly below.
   
   Worth clarifying that this overrides the normal use of the queues associated 
address as the target? Also that you probably dont typically want to use this 
with a 'match' style configuration as every matched queue's associated sender 
will then all send to the same target address? Should that config be prevented? 
Maybe need some documentation around all this either way?
   



##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java:
##########
@@ -282,18 +285,52 @@ public void validateMatching(Queue queue, 
AMQPBrokerConnectionElement connection
    public void createLink(Queue queue, AMQPBrokerConnectionElement 
connectionElement) {
       if (connectionElement.getType() == AMQPBrokerConnectionAddressType.PEER) 
{
          Symbol[] dispatchCapability = new 
Symbol[]{AMQPMirrorControllerSource.QPID_DISPATCH_WAYPOINT_CAPABILITY};
-         connectSender(queue, queue.getAddress().toString(), null, null, null, 
null, dispatchCapability, null);
-         connectReceiver(protonRemotingConnection, session, sessionContext, 
queue, dispatchCapability);
-      } else {
-         if (connectionElement.getType() == 
AMQPBrokerConnectionAddressType.SENDER) {
-            connectSender(queue, queue.getAddress().toString(), null, null, 
null, null, null, null);
+         connectSender(queue, queue.getAddress().toString(), null, null, null, 
null, null, null, dispatchCapability);
+         connectReceiver(protonRemotingConnection, session, sessionContext, 
queue, null, dispatchCapability);
+      } else if (connectionElement.getType() == 
AMQPBrokerConnectionAddressType.SENDER) {
+         String targetAddress = null;
+         Symbol[] targetCapabilities = null;
+
+         if (connectionElement instanceof AMQPSenderBrokerConnectionElement) {
+            final AMQPSenderBrokerConnectionElement sender = 
(AMQPSenderBrokerConnectionElement) connectionElement;
+
+            targetAddress = sender.getTargetAddress();
+            targetCapabilities = 
parseTerminusCapabilities(sender.getTargetCapabilities());
          }
-         if (connectionElement.getType() == 
AMQPBrokerConnectionAddressType.RECEIVER) {
-            connectReceiver(protonRemotingConnection, session, sessionContext, 
queue);
+
+         connectSender(queue, queue.getAddress().toString(), null, null, null, 
null, null, targetAddress, targetCapabilities);

Review Comment:
   Could we actually just move the other 'is an explicit override address 
defined' bit here, and then simply pass 'targetName' as before (perhaps renamed 
to targetAddress though?), but which is then either the queues address as 
originally, or the new configured 'override' target if defined? Would save 
passing around 2 competing values for 1 thing and leave the other code simpler 
/ as-is.
   
   Similarly for the receiver bit below.





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

    Worklog Id:     (was: 920605)
    Time Spent: 20m  (was: 10m)

> Broker connections (AMQP) with receiver operation not working
> -------------------------------------------------------------
>
>                 Key: ARTEMIS-4777
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4777
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.33.0
>         Environment: Server installed on CentOS Linux release 7.9.2009
>            Reporter: Piero Cena
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Trying to connect an Artemis instance to an instance of ActiveMQ Classic 5.15 
> in order to receive messages from one destination (preferably a topic 
> destination). Here is the configuration on Artemis instance:
> {code:xml}
> <broker-connections>
>    <amqp-connection uri="tcp://amq_classic_host:5673" name="activemq-classic" 
> retry-interval="1000" reconnect-attempts="2" user="xxx{*}" password="xxx{*}">
>       <receiver address-match="test"/>
>    </amqp-connection>
> </broker-connections>{code}
> The address "test" is predefined as multicast on Artemis and exists on the 
> other side:
> {code:xml}
> <address name="test">
>    <multicast/>
> </address>{code} 
> On startup Artemis will connect correctly to Classic but no message is 
> received on the Artemis side when published to the Classic destination "test".
> The same test has done with two Artemis brokers, one configured as above, but 
> the results are the same.
> Only "sender" or "mirror" operations seem to work properly (between 2 
> Artemis).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to