@Override public Object getCorrelationId() { return (_properties == null) ? null : _properties.getCorrelationId(); }
@Override public Object getCorrelationId() { return (_properties == null) ? null : _properties.getCorrelationId(); }
@Override public Object getCorrelationId() { return (_properties == null) ? null : _properties.getCorrelationId(); }
@Override public Object getCorrelationId() { return (_properties == null) ? null : _properties.getCorrelationId(); }
@Override public String getCorrelationId() { if (properties == null) { return null; } return AmqpMessageIdHelper.toCorrelationIdString(properties.getCorrelationId()); }
@Override public String getCorrelationId() { if (properties == null) { return null; } return AmqpMessageIdHelper.toCorrelationIdString(properties.getCorrelationId()); }
/** * Return the set CorrelationId value in String form, if there are no properties * in the given message return null. * * @return the set correlation ID in String form or null if not set. */ public String getCorrelationId() { if (message.getProperties() == null || message.getProperties().getCorrelationId() == null) { return null; } return message.getProperties().getCorrelationId().toString(); }
/** * Return the set CorrelationId value in the original form, if there are no properties * in the given message return null. * * @return the set message ID in its original form or null if not set. */ public Object getRawCorrelationId() { if (message.getProperties() == null) { return null; } return message.getProperties().getCorrelationId(); }
@Override public byte[] getCorrelationIdBytes() throws JMSException { Object correlationId = null; if (properties != null) { correlationId = properties.getCorrelationId(); } if (correlationId == null) { return null; } else if (correlationId instanceof Binary) { ByteBuffer dup = ((Binary) correlationId).asByteBuffer(); byte[] bytes = new byte[dup.remaining()]; dup.get(bytes); return bytes; } else { // TODO - Do we need to throw here, or could we just stringify whatever is in // there and return the UTF-8 bytes? This method is pretty useless so // maybe we just return something and let the user sort if out if they // really think they need this. throw new JMSException("The underlying correlation-id is not binary and so can't be returned"); } }
@Override public byte[] getCorrelationIdBytes() throws JMSException { Object correlationId = null; if (properties != null) { correlationId = properties.getCorrelationId(); } if (correlationId == null) { return null; } else if (correlationId instanceof Binary) { ByteBuffer dup = ((Binary) correlationId).asByteBuffer(); byte[] bytes = new byte[dup.remaining()]; dup.get(bytes); return bytes; } else { // TODO - Do we need to throw here, or could we just stringify whatever is in // there and return the UTF-8 bytes? This method is pretty useless so // maybe we just return something and let the user sort if out if they // really think they need this. throw new JMSException("The underlying correlation-id is not binary and so can't be returned"); } }
return getAMQPUserID(); } else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) { if (properties != null && properties.getCorrelationId() != null) { return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
@Override public Object getObjectProperty(String key) { if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) { if (getProperties() != null) { return getProperties().getSubject(); } } else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) { return getConnectionID(); } else if (key.equals(MessageUtil.JMSXGROUPID)) { return getGroupID(); } else if (key.equals(MessageUtil.JMSXUSERID)) { return getAMQPUserID(); } else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) { if (getProperties() != null && getProperties().getCorrelationId() != null) { return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(getProperties().getCorrelationId()); } } else { Object value = getApplicationPropertiesMap().get(key); if (value instanceof UnsignedInteger || value instanceof UnsignedByte || value instanceof UnsignedLong || value instanceof UnsignedShort) { return ((Number)value).longValue(); } else { return value; } } return null; }
/** * Converts an AMQPS message to a corresponding IoT Hub message. * * @param protonMsg the AMQPS message. * @throws TransportException if the conversion fails * @return the corresponding IoT Hub message. */ @Override protected IotHubTransportMessage protonMessageToIoTHubMessage(MessageImpl protonMsg) throws TransportException { IotHubTransportMessage iotHubTransportMessage = super.protonMessageToIoTHubMessage(protonMsg); iotHubTransportMessage.setMessageType(MessageType.DEVICE_METHODS); // Codes_SRS_AMQPSDEVICEMETHODS_12_046: [The function shall set the device operation type to DEVICE_OPERATION_METHOD_RECEIVE_REQUEST on IotHubTransportMessage.] iotHubTransportMessage.setDeviceOperationType(DeviceOperations.DEVICE_OPERATION_METHOD_RECEIVE_REQUEST); // Codes_SRS_AMQPSDEVICEMETHODS_12_025: [The function shall copy the method name from Proton application properties and set IotHubTransportMessage method name with it.] // Codes_SRS_AMQPSDEVICEMETHODS_12_026: [The function shall copy the Proton application properties to IotHubTransportMessage properties excluding the reserved property names.] if (protonMsg.getApplicationProperties() != null && protonMsg.getApplicationProperties().getValue() != null) { Map<String, Object> applicationProperties = protonMsg.getApplicationProperties().getValue(); if (applicationProperties.containsKey(APPLICATION_PROPERTY_KEY_IOTHUB_METHOD_NAME)) { iotHubTransportMessage.setMethodName(applicationProperties.get(APPLICATION_PROPERTY_KEY_IOTHUB_METHOD_NAME).toString()); } } if (protonMsg.getProperties() != null && protonMsg.getProperties().getCorrelationId() != null) { iotHubTransportMessage.setRequestId(protonMsg.getProperties().getCorrelationId().toString()); } return iotHubTransportMessage; }
private boolean checkMessageProperties(AMQPMessage message, Map<String, Object> expectedProperties) { assertNotNull(message); assertNotNull(server.getNodeID()); assertNotNull(message.getConnectionID()); assertEquals(message.getAddress(), expectedProperties.get(ADDRESS)); assertEquals(message.isDurable(), expectedProperties.get(DURABLE)); Properties props = message.getProperties(); assertEquals(props.getCorrelationId(), expectedProperties.get(CORRELATION_ID)); assertEquals(props.getReplyTo(), expectedProperties.get(REPLY_TO)); assertEquals(props.getMessageId(), expectedProperties.get(MESSAGE_ID)); Header header = message.getHeader(); assertEquals(header.getDurable(), expectedProperties.get(DURABLE)); assertEquals(header.getTtl().toString(), expectedProperties.get(TIME_TO_LIVE).toString()); assertEquals(header.getPriority().toString(), expectedProperties.get(PRIORITY).toString()); return true; }
return _impl.getReplyTo(); case 5: return _impl.getCorrelationId(); case 6: return _impl.getContentType();
return _impl.getReplyTo(); case 5: return _impl.getCorrelationId(); case 6: return _impl.getContentType();
return _impl.getReplyTo(); case 5: return _impl.getCorrelationId(); case 6: return _impl.getContentType();
public int size() { return _impl.getReplyToGroupId() != null ? 13 : _impl.getGroupSequence() != null ? 12 : _impl.getGroupId() != null ? 11 : _impl.getCreationTime() != null ? 10 : _impl.getAbsoluteExpiryTime() != null ? 9 : _impl.getContentEncoding() != null ? 8 : _impl.getContentType() != null ? 7 : _impl.getCorrelationId() != null ? 6 : _impl.getReplyTo() != null ? 5 : _impl.getSubject() != null ? 4 : _impl.getTo() != null ? 3 : _impl.getUserId() != null ? 2 : _impl.getMessageId() != null ? 1 : 0; }
public int size() { return _impl.getReplyToGroupId() != null ? 13 : _impl.getGroupSequence() != null ? 12 : _impl.getGroupId() != null ? 11 : _impl.getCreationTime() != null ? 10 : _impl.getAbsoluteExpiryTime() != null ? 9 : _impl.getContentEncoding() != null ? 8 : _impl.getContentType() != null ? 7 : _impl.getCorrelationId() != null ? 6 : _impl.getReplyTo() != null ? 5 : _impl.getSubject() != null ? 4 : _impl.getTo() != null ? 3 : _impl.getUserId() != null ? 2 : _impl.getMessageId() != null ? 1 : 0; }
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; }