本文整理汇总了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);
}
}