Java Code Examples for org.apache.qpid.proton.amqp.messaging.Properties#getGroupId()

The following examples show how to use org.apache.qpid.proton.amqp.messaging.Properties#getGroupId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastPathPropertiesType.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
private int getElementCount(Properties properties) {
    if (properties.getReplyToGroupId() != null) {
        return 13;
    } else if (properties.getGroupSequence() != null) {
        return 12;
    } else if (properties.getGroupId() != null) {
        return 11;
    } else if (properties.getCreationTime() != null) {
        return 10;
    } else if (properties.getAbsoluteExpiryTime() != null) {
        return 9;
    } else if (properties.getContentEncoding() != null) {
        return 8;
    } else if (properties.getContentType() != null) {
        return 7;
    } else if (properties.getCorrelationId() != null) {
        return 6;
    } else if (properties.getReplyTo() != null) {
        return 5;
    } else if (properties.getSubject() != null) {
        return 4;
    } else if (properties.getTo() != null) {
        return 3;
    } else if (properties.getUserId() != null) {
        return 2;
    } else if (properties.getMessageId() != null) {
        return 1;
    }

    return 0;
}
 
Example 2
Source File: AmqpCoreConverter.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
private static ServerJMSMessage processProperties(ServerJMSMessage jms, Properties properties, MessageAnnotations annotations) throws Exception {
   if (properties != null) {
      if (properties.getMessageId() != null) {
         jms.setJMSMessageID(AMQPMessageIdHelper.INSTANCE.toMessageIdString(properties.getMessageId()));
         //core jms clients get JMSMessageID from UserID which is a UUID object
         if (properties.getMessageId() instanceof UUID) {
            //AMQP's message ID can be a UUID, keep it
            jms.getInnerMessage().setUserID(UUIDGenerator.getInstance().fromJavaUUID((UUID) properties.getMessageId()));
         } else {
            jms.getInnerMessage().setUserID(UUIDGenerator.getInstance().generateUUID());
         }
      }

      Binary userId = properties.getUserId();
      if (userId != null) {
         jms.setStringProperty("JMSXUserID", new String(userId.getArray(), userId.getArrayOffset(), userId.getLength(), StandardCharsets.UTF_8));
      }
      if (properties.getTo() != null) {
         byte queueType = parseQueueAnnotation(annotations, AMQPMessageSupport.JMS_DEST_TYPE_MSG_ANNOTATION);
         jms.setJMSDestination(AMQPMessageSupport.destination(queueType, properties.getTo()));
      }
      if (properties.getSubject() != null) {
         jms.setJMSType(properties.getSubject());
      }
      if (properties.getReplyTo() != null) {
         byte value = parseQueueAnnotation(annotations, AMQPMessageSupport.JMS_REPLY_TO_TYPE_MSG_ANNOTATION);

         switch (value) {
            case AMQPMessageSupport.QUEUE_TYPE:
               org.apache.activemq.artemis.reader.MessageUtil.setJMSReplyTo(jms.getInnerMessage(), ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + properties.getReplyTo());
               break;
            case AMQPMessageSupport.TEMP_QUEUE_TYPE:
               org.apache.activemq.artemis.reader.MessageUtil.setJMSReplyTo(jms.getInnerMessage(), ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX + properties.getReplyTo());
               break;
            case AMQPMessageSupport.TOPIC_TYPE:
               org.apache.activemq.artemis.reader.MessageUtil.setJMSReplyTo(jms.getInnerMessage(), ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + properties.getReplyTo());
               break;
            case AMQPMessageSupport.TEMP_TOPIC_TYPE:
               org.apache.activemq.artemis.reader.MessageUtil.setJMSReplyTo(jms.getInnerMessage(), ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX + properties.getReplyTo());
               break;
            default:
               org.apache.activemq.artemis.reader.MessageUtil.setJMSReplyTo(jms.getInnerMessage(), ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + properties.getReplyTo());
               break;
         }
      }
      Object correlationID = properties.getCorrelationId();

      if (correlationID != null) {
         try {
            jms.getInnerMessage().setCorrelationID(AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(correlationID));
         } catch (IllegalArgumentException e) {
            jms.getInnerMessage().setCorrelationID(String.valueOf(correlationID));
         }
      }
      if (properties.getContentType() != null) {
         jms.setStringProperty(JMS_AMQP_CONTENT_TYPE, properties.getContentType().toString());
      }
      if (properties.getContentEncoding() != null) {
         jms.setStringProperty(JMS_AMQP_CONTENT_ENCODING, properties.getContentEncoding().toString());
      }
      if (properties.getCreationTime() != null) {
         jms.setJMSTimestamp(properties.getCreationTime().getTime());
      }
      if (properties.getGroupId() != null) {
         jms.setStringProperty("_AMQ_GROUP_ID", properties.getGroupId());
      }
      if (properties.getGroupSequence() != null) {
         jms.setIntProperty("JMSXGroupSeq", properties.getGroupSequence().intValue());
      }
      if (properties.getReplyToGroupId() != null) {
         jms.setStringProperty(JMS_AMQP_REPLYTO_GROUP_ID, properties.getReplyToGroupId());
      }
      if (properties.getAbsoluteExpiryTime() != null) {
         jms.setJMSExpiration(properties.getAbsoluteExpiryTime().getTime());
      }
   }
   return jms;
}