public void dropMessage(IMessage message) { Map<String, Object> headers = message.getHeaders(); Map<String, Object> cleanHeaders = new HashMap<String, Object>(); Set<Entry<String, Object>> entrySet = headers.entrySet(); for (Entry<String, Object> entry : entrySet) { String key = entry.getKey(); Object value = entry.getValue(); if (value != null && !ignoreSendHeaders.contains(key)) { if (Objects.equal("JMSReplyTo", key)) { value = JmsTypeConverters.toDestination(value); } else if (Objects.equal("JMSExpiration", key)) { value = JmsTypeConverters.toTimestamp(value); } else if (Objects.equal("JMSTimestamp", key)) { value = JmsTypeConverters.toTimestamp(value); } else if (Objects.equal("JMSDeliveryMode", key)) { value = JmsTypeConverters.toDeliveryMode(value); } else if (Objects.equal("JMSRedelivered", key)) { value = JmsTypeConverters.toBoolean(value); } else if (Objects.equal("JMSPriority", key)) { value = JmsTypeConverters.toInteger(value); } if (value != null) { cleanHeaders.put(key, value); } } } String body = Strings.getOrElse(message.getBody()); try { // TODO store username/pwd on a queue basis? String userName = getBrokerNode().getUserName(); String password = getBrokerNode().getPassword(); if (userName != null && password != null) { destination.sendTextMessage(cleanHeaders, body, userName, password); } else { destination.sendTextMessage(cleanHeaders, body); } } catch (Exception e) { FabricPlugin.showUserError( "Send message to " + this + " failed", "Could not send message to " + this, e); } }
public String getText() { if (text == null) { text = Strings.getOrElse(value, ""); } return text; }