Code review comment: Needed because ttl is milliseconds as integer, so it can't support time to live of more than 50 days. That's why we had to change it.

Code under review:
public static Message convertAmqpMessageToBrokeredMessage(org.apache.qpid.proton.message.Message amqpMessage, byte[] deliveryTag) {
        Message brokeredMessage;
        Section body = amqpMessage.getBody();
        if (body != null) {
            if (body instanceof Data) {
                Binary messageData = ((Data) body).getValue();
                brokeredMessage = new Message(Utils.fromBinay(messageData.getArray()));
            } else if (body instanceof AmqpValue) {
                Object messageData = ((AmqpValue) body).getValue();
                brokeredMessage = new Message(MessageBody.fromValueData(messageData));
            } else if (body instanceof AmqpSequence) {
                List<Object> messageData = ((AmqpSequence) body).getValue();
                brokeredMessage = new Message(Utils.fromSequence(messageData));
            } else {
                
                brokeredMessage = new Message();
            }
        } else {
            brokeredMessage = new Message();
        }

        
        ApplicationProperties applicationProperties = amqpMessage.getApplicationProperties();
        if (applicationProperties != null) {
            brokeredMessage.setProperties(applicationProperties.getValue());
        }

        
        
        brokeredMessage.setDeliveryCount(amqpMessage.getDeliveryCount() + 1);
        long ttlMillis = amqpMessage.getTtl();
        if (ttlMillis > 0l) {
        	brokeredMessage.setTimeToLive(Duration.ofMillis(ttlMillis));
        }

        
        
        if (amqpMessage.getCreationTime() != 0l && amqpMessage.getExpiryTime() != 0l) {
        	ttlMillis = amqpMessage.getExpiryTime() - amqpMessage.getCreationTime();
        	if (ttlMillis > 0l)	{
        		brokeredMessage.setTimeToLive(Duration.ofMillis(ttlMillis));
        	}
        }
        
        Object messageId = amqpMessage.getMessageId();
        if (messageId != null) {
            brokeredMessage.setMessageId(messageId.toString());
        }

        brokeredMessage.setContentType(amqpMessage.getContentType());
        Object correlationId = amqpMessage.getCorrelationId();
        if (correlationId != null) {
            brokeredMessage.setCorrelationId(correlationId.toString());
        }

        Properties properties = amqpMessage.getProperties();
        if (properties != null) {
            brokeredMessage.setTo(properties.getTo());
        }

        brokeredMessage.setLabel(amqpMessage.getSubject());
        brokeredMessage.setReplyTo(amqpMessage.getReplyTo());
        brokeredMessage.setReplyToSessionId(amqpMessage.getReplyToGroupId());
        brokeredMessage.setSessionId(amqpMessage.getGroupId());

        
        MessageAnnotations messageAnnotations = amqpMessage.getMessageAnnotations();
        if (messageAnnotations != null) {
            Map<Symbol, Object> messageAnnotationsMap = messageAnnotations.getValue();
            if (messageAnnotationsMap != null) {
                for (Map.Entry<Symbol, Object> entry : messageAnnotationsMap.entrySet()) {
                    String entryName = entry.getKey().toString();
                    switch (entryName) {
                        case ClientConstants.ENQUEUEDTIMEUTCNAME:
                            brokeredMessage.setEnqueuedTimeUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.SCHEDULEDENQUEUETIMENAME:
                            brokeredMessage.setScheduledEnqueueTimeUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.SEQUENCENUBMERNAME:
                            brokeredMessage.setSequenceNumber((long) entry.getValue());
                            break;
                        case ClientConstants.LOCKEDUNTILNAME:
                            brokeredMessage.setLockedUntilUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.PARTITIONKEYNAME:
                            brokeredMessage.setPartitionKey((String) entry.getValue());
                            break;
                        case ClientConstants.VIAPARTITIONKEYNAME:
                            brokeredMessage.setViaPartitionKey((String) entry.getValue());
                            break;
                        case ClientConstants.DEADLETTERSOURCENAME:
                            brokeredMessage.setDeadLetterSource((String) entry.getValue());
                            break;
                        default:
                            break;
                    }
                }
            }
        }

        if (deliveryTag != null && deliveryTag.length == ClientConstants.LOCKTOKENSIZE) {
            UUID lockToken = Util.convertDotNetBytesToUUID(deliveryTag);
            brokeredMessage.setLockToken(lockToken);
        } else {
            brokeredMessage.setLockToken(ClientConstants.ZEROLOCKTOKEN);
        }

        brokeredMessage.setDeliveryTag(deliveryTag);

        return brokeredMessage;
    }

Line commented on: ttlMillis = amqpMessage.getExpiryTime() - amqpMessage.getCreationTime();

Revised code:
public static Message convertAmqpMessageToBrokeredMessage(org.apache.qpid.proton.message.Message amqpMessage, byte[] deliveryTag) {
        Message brokeredMessage;
        Section body = amqpMessage.getBody();
        if (body != null) {
            if (body instanceof Data) {
                Binary messageData = ((Data) body).getValue();
                brokeredMessage = new Message(Utils.fromBinay(messageData.getArray()));
            } else if (body instanceof AmqpValue) {
                Object messageData = ((AmqpValue) body).getValue();
                brokeredMessage = new Message(MessageBody.fromValueData(messageData));
            } else if (body instanceof AmqpSequence) {
                List<Object> messageData = ((AmqpSequence) body).getValue();
                brokeredMessage = new Message(Utils.fromSequence(messageData));
            } else {
                
                brokeredMessage = new Message();
            }
        } else {
            brokeredMessage = new Message();
        }

        
        ApplicationProperties applicationProperties = amqpMessage.getApplicationProperties();
        if (applicationProperties != null) {
            brokeredMessage.setProperties(applicationProperties.getValue());
        }

        
        
        brokeredMessage.setDeliveryCount(amqpMessage.getDeliveryCount() + 1);
        long ttlMillis = amqpMessage.getTtl();
        if (ttlMillis > 0l) {
        	brokeredMessage.setTimeToLive(Duration.ofMillis(ttlMillis));
        }

        
        
        if (amqpMessage.getCreationTime() != 0l && amqpMessage.getExpiryTime() != 0l) {
        	ttlMillis = amqpMessage.getExpiryTime() - amqpMessage.getCreationTime();
        	if (ttlMillis > 0l)	{
        		brokeredMessage.setTimeToLive(Duration.ofMillis(ttlMillis));
        	}
        }
        
        Object messageId = amqpMessage.getMessageId();
        if (messageId != null) {
            brokeredMessage.setMessageId(messageId.toString());
        }

        brokeredMessage.setContentType(amqpMessage.getContentType());
        Object correlationId = amqpMessage.getCorrelationId();
        if (correlationId != null) {
            brokeredMessage.setCorrelationId(correlationId.toString());
        }

        Properties properties = amqpMessage.getProperties();
        if (properties != null) {
            brokeredMessage.setTo(properties.getTo());
        }

        brokeredMessage.setLabel(amqpMessage.getSubject());
        brokeredMessage.setReplyTo(amqpMessage.getReplyTo());
        brokeredMessage.setReplyToSessionId(amqpMessage.getReplyToGroupId());
        brokeredMessage.setSessionId(amqpMessage.getGroupId());

        
        MessageAnnotations messageAnnotations = amqpMessage.getMessageAnnotations();
        if (messageAnnotations != null) {
            Map<Symbol, Object> messageAnnotationsMap = messageAnnotations.getValue();
            if (messageAnnotationsMap != null) {
                for (Map.Entry<Symbol, Object> entry : messageAnnotationsMap.entrySet()) {
                    String entryName = entry.getKey().toString();
                    switch (entryName) {
                        case ClientConstants.ENQUEUEDTIMEUTCNAME:
                            brokeredMessage.setEnqueuedTimeUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.SCHEDULEDENQUEUETIMENAME:
                            brokeredMessage.setScheduledEnqueueTimeUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.SEQUENCENUBMERNAME:
                            brokeredMessage.setSequenceNumber((long) entry.getValue());
                            break;
                        case ClientConstants.LOCKEDUNTILNAME:
                            brokeredMessage.setLockedUntilUtc(((Date) entry.getValue()).toInstant());
                            break;
                        case ClientConstants.PARTITIONKEYNAME:
                            brokeredMessage.setPartitionKey((String) entry.getValue());
                            break;
                        case ClientConstants.VIAPARTITIONKEYNAME:
                            brokeredMessage.setViaPartitionKey((String) entry.getValue());
                            break;
                        case ClientConstants.DEADLETTERSOURCENAME:
                            brokeredMessage.setDeadLetterSource((String) entry.getValue());
                            break;
                        default:
                            break;
                    }
                }
            }
        }

        if (deliveryTag != null && deliveryTag.length == ClientConstants.LOCKTOKENSIZE) {
            UUID lockToken = Util.convertDotNetBytesToUUID(deliveryTag);
            brokeredMessage.setLockToken(lockToken);
        } else {
            brokeredMessage.setLockToken(ClientConstants.ZEROLOCKTOKEN);
        }

        brokeredMessage.setDeliveryTag(deliveryTag);

        return brokeredMessage;
    }