本文整理匯總了Java中javax.jms.Message.getPropertyNames方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.getPropertyNames方法的具體用法?Java Message.getPropertyNames怎麽用?Java Message.getPropertyNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.jms.Message
的用法示例。
在下文中一共展示了Message.getPropertyNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: JmsTextMapExtractAdapter
import javax.jms.Message; //導入方法依賴的package包/類
public JmsTextMapExtractAdapter(Message message) {
try {
Enumeration enumeration = message.getPropertyNames();
if (enumeration != null) {
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
Object value = message.getObjectProperty(key);
if (value instanceof String) {
map.put(decodeDash(key), (String) value);
}
}
}
} catch (JMSException e) {
throw new RuntimeException(e);
}
}
示例2: addData
import javax.jms.Message; //導入方法依賴的package包/類
private void addData(Message message, String text) throws JMSException {
MessageData data = new MessageData();
data.setPayload(text);
Map<String, String> headers = new HashMap<>();
Enumeration<String> names = message.getPropertyNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
String value = message.getStringProperty(name);
headers.put(name, value);
}
data.setHeaders(headers);
messages.add(data);
}
示例3: extractMessageProperties
import javax.jms.Message; //導入方法依賴的package包/類
/**
*
*/
@SuppressWarnings("unchecked")
private Map<String, String> extractMessageProperties(Message message) {
Map<String, String> properties = new HashMap<>();
try {
Enumeration<String> propertyNames = message.getPropertyNames();
while (propertyNames.hasMoreElements()) {
String propertyName = propertyNames.nextElement();
properties.put(propertyName, String.valueOf(message.getObjectProperty(propertyName)));
}
} catch (JMSException e) {
this.processLog.warn("Failed to extract message properties", e);
}
return properties;
}
示例4: addData
import javax.jms.Message; //導入方法依賴的package包/類
private void addData(Message message, String text) throws JMSException {
MessageData data = new MessageData();
data.setPayload(text);
Map<String, String> headers = new HashMap<String, String>();
Enumeration<String> names = message.getPropertyNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
String value = message.getStringProperty(name);
headers.put(name, value);
}
data.setHeaders(headers);
messages.add(data);
}
示例5: onMessage
import javax.jms.Message; //導入方法依賴的package包/類
/**
* MessageListener回調函數.
*/
@Override
public void onMessage(Message message) {
try {
message.getPropertyNames();
/*MapMessage mapMessage = (MapMessage) message;
// 打印消息詳情
String subject=mapMessage.getObject("subject").toString();
String to=mapMessage.getObject("to").toString();
String date=mapMessage.getObject("date").toString();
String username=mapMessage.getObject("username").toString();
String content=mapMessage.getObject("content").toString();*/
String subject= "柯遠";
String to="xx";
String date="2013-03-20";
String username="keyuan";
String content="activmq測試郵件";
//mapMessage.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, 15*1000);
System.out.println("收到了消息");
logger.info("subject:" + subject+";to:"+to+";date:"+date+";username:"+username+";content:"+content+";");
Email email=new Email();
email.setContent(content);
email.setDate(date);
email.setSubject(subject);
email.setTo(to);
email.setUsername(username);
// 發送郵件
// if (simpleMailService != null) {
// simpleMailService.sendNotificationMail("柯遠。。。");
// }
} catch (JMSException e) {
logger.error(e.getMessage(), e);
}
}