本文整理了Java中org.apache.activemq.artemis.api.core.Message.toMap()
方法的一些代码示例,展示了Message.toMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.toMap()
方法的具体详情如下:
包路径:org.apache.activemq.artemis.api.core.Message
类名称:Message
方法名:toMap
暂无
代码示例来源:origin: apache/activemq-artemis
@Override
public Map<String, Object> decodeMessageProperties(Message msg) {
return msg.toMap();
}
}
代码示例来源:origin: apache/activemq-artemis
@Override
public Map<String, Object> decodeMessageProperties(Message msg) {
try {
return ActiveMQMessage.coreMaptoJMSMap(msg.toMap());
} catch (Throwable t) {
return null;
}
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* @param refs
* @return
*/
private Map<String, Object>[] convertMessagesToMaps(List<MessageReference> refs) throws ActiveMQException {
Map<String, Object>[] messages = new Map[refs.size()];
int i = 0;
for (MessageReference ref : refs) {
Message message = ref.getMessage();
messages[i++] = message.toMap();
}
return messages;
}
代码示例来源:origin: apache/activemq-artemis
protected Map<String, Object>[] getFirstMessage() throws Exception {
checkStarted();
clearIO();
try {
List<Map<String, Object>> messages = new ArrayList<>();
queue.flushExecutor();
try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) {
// returns just the first, as it's the first only
if (iterator.hasNext()) {
MessageReference ref = iterator.next();
Message message = ref.getMessage();
messages.add(message.toMap());
}
return messages.toArray(new Map[1]);
}
} finally {
blockOnIO();
}
}
代码示例来源:origin: apache/activemq-artemis
@Override
public Map<String, Object>[] listMessages(final String filterStr) throws Exception {
checkStarted();
clearIO();
try {
Filter filter = FilterImpl.createFilter(filterStr);
List<Map<String, Object>> messages = new ArrayList<>();
queue.flushExecutor();
try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) {
try {
while (iterator.hasNext()) {
MessageReference ref = iterator.next();
if (filter == null || filter.match(ref.getMessage())) {
Message message = ref.getMessage();
messages.add(message.toMap());
}
}
} catch (NoSuchElementException ignored) {
// this could happen through paging browsing
}
return messages.toArray(new Map[messages.size()]);
}
} catch (ActiveMQException e) {
throw new IllegalStateException(e.getMessage());
} finally {
blockOnIO();
}
}
内容来源于网络,如有侵权,请联系作者删除!