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

Alex Rudyy commented on QPID-7635:
----------------------------------

Lorenz,
I did not realize that we have a support for a older message format on AMQP 1.0 
path. Thus, my proposed changes are not correct. However, I still believe that 
moving routing logic from {{ReceivingDestination}} into {{ServerMessage}} is 
wrong thing. I think ,that routing functionality should belong to 
{{ReceivingDestination}}  and it should  be based on 
{{ServerMessage#getInitialRoutingAddress()}}. I attached a new patch modifying 
{{Message_1_0#getInitialRoutingAddress()}} to take into consideration headers 
"to", "routing-key", "routing_key" and "subject" as below:
{code}
MessageMetaData_1_0.MessageHeader_1_0 messageHeader = getMessageHeader();
String routingAddress = null;
final String to = messageHeader.getTo();
if (to != null)
{
    routingAddress = to;
}
else if (messageHeader.getHeader("routing-key") instanceof String)
{
    routingAddress = (String) messageHeader.getHeader("routing-key");
}
else if (messageHeader.getHeader("routing_key") instanceof String)
{
    routingAddress = (String) messageHeader.getHeader("routing_key");
}
else if (messageHeader.getSubject() != null)
{
    routingAddress = messageHeader.getSubject();
}

return routingAddress;
{code}
The routing address detection functionality could be generalized for all 
message formats as below
{code}
static String getRoutingAddress(final ServerMessage<?> message, final String 
destinationName)
{
        String initialRoutingAddress = message.getInitialRoutingAddress();
        if (initialRoutingAddress != null && destinationName != null && 
initialRoutingAddress.startsWith(
                destinationName + "/"))
        {
            initialRoutingAddress = 
initialRoutingAddress.substring(destinationName.length() + 1);
        }
        return initialRoutingAddress;
}
{code}

The {{ExchangeDestination}} would have a routing address functionality  based 
on {{_initialRoutingAddress}} and above.
The patch with the suggested changes is attached. Please have a look.

> [Java Broker] If ANONYMOUS-RELAY finds the destination it should defer the 
> delivery outcome to the destination
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-7635
>                 URL: https://issues.apache.org/jira/browse/QPID-7635
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-broker-7.0.0
>            Reporter: Alex Rudyy
>             Fix For: qpid-java-broker-7.0.0
>
>         Attachments: 
> 0001-QPID-7635-Java-Broker-Refactor-resolution-of-routing-2.patch, 
> 0001-QPID-7635-Java-Broker-Refactor-resolution-of-routing.patch
>
>
> On publishing message using ANONYMOUS-RELAY when message is delivered to 
> queue with binding having filters not accepting the message the delivery 
> outcome is determined by anonymous relay (currently REJECTED) instead of 
> queue or exchange. If ANONYMOUS-RELAY finds the destination it should defer 
> the delivery outcome to the destination.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to