It's easier than that.
You just need to pass the maxDeliveryAttempts value into the constructor of the ServerConsumerEndpoint, in the method ServerSessionEndpoint::createConsumerDelegateInternal.
Take a look at how this is already done for expiryQueue or dlq which also has a local override that takes precendence over the server peer value.
Then you just need to remove the maxDeliveryAttempts attribute from the session and make sure you pass the correct value into ServerSessionEndpoint methods when called from ServerConsumerEndpoint
You'll need to add a maxDeliveryAttempts attribute to DeliveryRecord too, like is done with dlq, expiryQueue etc
I saw your commit.
Looks fine, but a couple of points:
a) Can you update the documentation
b) MaxDeliveryAttemptsTest probably belongs in DLQTest
c) In MaxDeliveryAttempts I can't see any test that verifies if MaxDeliveryAttempts is set to -1 then the value from the server peer is used.
a) and c) Will do.
b) I originally put the test into DLQTest but then decided to make a separate one because it looked out of place to me. Should I combine them nevertheless?
I think they should be combined.
After all, DLQTest currently has all the other tests related to maxDeliveryAttempts