@Override protected Map wrap(ApplicationProperties val) { return val.getValue(); }
void setApplicationProperties(ApplicationProperties applicationProperties) { if (applicationProperties != null) { this.applicationPropertiesMap = applicationProperties.getValue(); } }
@Override protected Map wrap(ApplicationProperties val) { return val.getValue(); }
@Override protected Map wrap(ApplicationProperties val) { return val.getValue(); }
@Override protected Map wrap(ApplicationProperties val) { return val.getValue(); }
void setApplicationProperties(ApplicationProperties applicationProperties) { if (applicationProperties != null) { this.applicationPropertiesMap = applicationProperties.getValue(); } }
private static ServerJMSMessage processApplicationProperties(ServerJMSMessage jms, ApplicationProperties properties) throws Exception { if (properties != null && properties.getValue() != null) { for (Map.Entry<String, Object> entry : (Set<Map.Entry<String, Object>>) properties.getValue().entrySet()) { setProperty(jms, entry.getKey(), entry.getValue()); } } return jms; }
public static String getResponseStatusDescription(Message responseMessage) { String statusDescription = (String)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_STATUS_DESCRIPTION); if(statusDescription == null) { statusDescription = (String)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_STATUS_DESCRIPTION); } return statusDescription; }
private static String getRegistrationAssertion(final Message msg, final boolean removeAssertion) { Objects.requireNonNull(msg); String assertion = null; final ApplicationProperties properties = msg.getApplicationProperties(); if (properties != null) { Object obj = null; if (removeAssertion) { obj = properties.getValue().remove(APP_PROPERTY_REGISTRATION_ASSERTION); } else { obj = properties.getValue().get(APP_PROPERTY_REGISTRATION_ASSERTION); } if (obj instanceof String) { assertion = (String) obj; } } return assertion; }
private static String getRegistrationAssertion(final Message msg, final boolean removeAssertion) { Objects.requireNonNull(msg); String assertion = null; final ApplicationProperties properties = msg.getApplicationProperties(); if (properties != null) { Object obj = null; if (removeAssertion) { obj = properties.getValue().remove(APP_PROPERTY_REGISTRATION_ASSERTION); } else { obj = properties.getValue().get(APP_PROPERTY_REGISTRATION_ASSERTION); } if (obj instanceof String) { assertion = (String) obj; } } return assertion; }
public static Symbol getResponseErrorCondition(Message responseMessage) { Symbol errorCondition = (Symbol)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_ERROR_CONDITION); if(errorCondition == null) { errorCondition = (Symbol)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_ERROR_CONDITION); } return errorCondition; }
public static int getResponseStatusCode(Message responseMessage) { int statusCode = ClientConstants.REQUEST_RESPONSE_UNDEFINED_STATUS_CODE; Object codeObject = responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_STATUS_CODE); if(codeObject == null) { codeObject = responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_STATUS_CODE); } if(codeObject != null) { statusCode = (int)codeObject; } return statusCode; }
private Map<String, Object> getApplicationPropertiesMap() { ApplicationProperties appMap = getApplicationProperties(); Map<String, Object> map = null; if (appMap != null) { map = appMap.getValue(); } if (map == null) { map = new HashMap<>(); this.applicationProperties = new ApplicationProperties(map); } return map; }
/** * Adds a property to an AMQP 1.0 message. * <p> * The property is added to the message's <em>application-properties</em>. * * @param msg The message. * @param key The property key. * @param value The property value. * @throws NullPointerException if any of th parameters are {@code null}. */ public static void addProperty(final Message msg, final String key, final Object value) { Objects.requireNonNull(msg); Objects.requireNonNull(key); Objects.requireNonNull(value); final ApplicationProperties props = Optional.ofNullable(msg.getApplicationProperties()) .orElseGet(() -> { final ApplicationProperties result = new ApplicationProperties(new HashMap<String, Object>()); msg.setApplicationProperties(result); return result; }); props.getValue().put(key, value); }
@SuppressWarnings("unchecked") private Map<String, Object> getApplicationPropertiesMap(boolean createIfAbsent) { ApplicationProperties appMap = lazyDecodeApplicationProperties(); Map<String, Object> map = null; if (appMap != null) { map = appMap.getValue(); } if (map == null) { if (createIfAbsent) { map = new HashMap<>(); this.applicationProperties = new ApplicationProperties(map); } else { map = Collections.EMPTY_MAP; } } return map; }
/** * Gets the application properties of a message if any. * * @return The application properties. * @throws IllegalStateException if this command is invalid. */ public Map<String, Object> getApplicationProperties() { if (isValid()) { if (message.getApplicationProperties() == null) { return null; } return message.getApplicationProperties().getValue(); } else { throw new IllegalStateException("command is invalid"); } } /**
private void handleMessage(final String endpoint, final Message msg) { final String deviceId = MessageHelper.getDeviceId(msg); final Buffer payload = MessageHelper.getPayload(msg); LOG.info("received {} message [device: {}, content-type: {}]: {}", endpoint, deviceId, msg.getContentType(), payload); if (msg.getApplicationProperties() != null) { LOG.info("... with application properties: {}", msg.getApplicationProperties().getValue()); } }
public Message request(Message message, long timeout, TimeUnit timeUnit) { Map<String, Object> properties = new HashMap<>(); if (message.getApplicationProperties() != null) { properties.putAll(message.getApplicationProperties().getValue()); } message.setApplicationProperties(new ApplicationProperties(properties)); if (message.getReplyTo() == null) { message.setReplyTo(replyTo); } context.runOnContext(h -> sender.send(message)); try { return replies.poll(timeout, timeUnit); } catch (InterruptedException e) { throw new RuntimeException(e); } }
@Override public void write(ApplicationProperties val) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); MapType mapType = (MapType) getEncoder().getType(val.getValue()); mapType.setKeyEncoding(stringType); mapType.write(val.getValue()); mapType.setKeyEncoding(null); }
/** * Creates a new AmqpMessage that wraps the information necessary to handle * an incoming delivery. * * @param receiver the AmqpReceiver that received this message. * @param message the Proton message that was received. * @param delivery the Delivery instance that produced this message. */ @SuppressWarnings("unchecked") public AmqpMessage(AmqpReceiver receiver, Message message, Delivery delivery) { this.receiver = receiver; this.message = message; this.delivery = delivery; if (message.getMessageAnnotations() != null) { messageAnnotationsMap = message.getMessageAnnotations().getValue(); } if (message.getApplicationProperties() != null) { applicationPropertiesMap = message.getApplicationProperties().getValue(); } if (message.getDeliveryAnnotations() != null) { deliveryAnnotationsMap = message.getDeliveryAnnotations().getValue(); } }