org.apache.activemq.artemis.api.core.Message.toCore()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(309)

本文整理了Java中org.apache.activemq.artemis.api.core.Message.toCore()方法的一些代码示例,展示了Message.toCore()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.toCore()方法的具体详情如下:
包路径:org.apache.activemq.artemis.api.core.Message
类名称:Message
方法名:toCore

Message.toCore介绍

[英]This should make you convert your message into Core format.
[中]这会让你把信息转换成核心格式。

代码示例

代码示例来源:origin: wildfly/wildfly

/**
* Used by ActiveMQ Artemis management service.
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception {
 SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString();
 String jsonString = (sstring == null) ? null : sstring.toString();
 if (jsonString != null) {
   JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
   return JsonUtil.fromJsonArray(jsonArray);
 } else {
   return null;
 }
}

代码示例来源:origin: wildfly/wildfly

@Override
public void copyHeadersAndProperties(final Message msg) {
 messageID = msg.getMessageID();
 address = msg.getAddressSimpleString();
 userID = (UUID) msg.getUserID();
 type = msg.toCore().getType();
 durable = msg.isDurable();
 expiration = msg.getExpiration();
 timestamp = msg.getTimestamp();
 priority = msg.getPriority();
 if (msg instanceof CoreMessage) {
   properties = ((CoreMessage) msg).getTypedProperties();
 }
}

代码示例来源:origin: wildfly/wildfly

ICoreMessage msg = msgToSend.toCore();

代码示例来源:origin: apache/activemq-artemis

public ServerMessageImpl(Message message) {
 super(message.toCore());
 this.message = (CoreMessage) message.toCore();
}

代码示例来源:origin: apache/activemq-artemis

public static AMQPMessage checkAMQP(Message message) throws Exception {
 if (message instanceof AMQPMessage) {
   return (AMQPMessage)message;
 } else {
   // It will first convert to Core, then to AMQP
   return fromCore(message.toCore());
 }
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

public static AMQPMessage checkAMQP(Message message) throws Exception {
 if (message instanceof AMQPMessage) {
   return (AMQPMessage)message;
 } else {
   // It will first convert to Core, then to AMQP
   return fromCore(message.toCore());
 }
}

代码示例来源:origin: org.apache.activemq/artemis-cli

private void printAllMessagesAsXML() throws Exception {
 xmlWriter.writeStartElement(XmlDataConstants.MESSAGES_PARENT);
 // Order here is important.  We must process the messages from the journal before we process those from the page
 // files in order to get the messages in the right order.
 for (Map.Entry<Long, Message> messageMapEntry : messages.entrySet()) {
   printSingleMessageAsXML(messageMapEntry.getValue().toCore(), extractQueueNames(messageRefs.get(messageMapEntry.getKey())));
 }
 printPagedMessagesAsXML();
 xmlWriter.writeEndElement(); // end "messages"
}

代码示例来源:origin: apache/activemq-artemis

private void printAllMessagesAsXML() throws Exception {
 xmlWriter.writeStartElement(XmlDataConstants.MESSAGES_PARENT);
 // Order here is important.  We must process the messages from the journal before we process those from the page
 // files in order to get the messages in the right order.
 for (Map.Entry<Long, Message> messageMapEntry : messages.entrySet()) {
   printSingleMessageAsXML(messageMapEntry.getValue().toCore(), extractQueueNames(messageRefs.get(messageMapEntry.getKey())));
 }
 printPagedMessagesAsXML();
 xmlWriter.writeEndElement(); // end "messages"
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int sendMessage(MessageReference reference,
           org.apache.activemq.artemis.api.core.Message message,
           ServerConsumer consumer,
           int deliveryCount) {
 AMQConsumer theConsumer = (AMQConsumer) consumer.getProtocolData();
 //clear up possible rolledback ids.
 theConsumer.removeRolledback(reference);
 return theConsumer.handleDeliver(reference, message.toCore(), deliveryCount);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int sendMessage(MessageReference reference,
           Message message,
           ServerConsumer consumer,
           int deliveryCount) {
 try {
   session.getMqttPublishManager().sendMessage(message.toCore(), consumer, deliveryCount);
 } catch (Exception e) {
   log.warn("Unable to send message: " + message.getMessageID() + " Cause: " + e.getMessage(), e);
 }
 return 1;
}

代码示例来源:origin: apache/activemq-artemis

/**
* Base64 encode a ServerMessage body into the proper XML format
*/
static String encodeMessageBodyBase64(final Message message) throws Exception {
 Preconditions.checkNotNull(message, "ServerMessage can not be null");
 ActiveMQBuffer byteBuffer = message.toCore().getReadOnlyBodyBuffer();
 byte[] buffer = new byte[byteBuffer.writerIndex()];
 byteBuffer.readBytes(buffer);
 return XmlDataExporterUtil.encode(buffer);
}

代码示例来源:origin: org.apache.activemq/artemis-cli

/**
* Base64 encode a ServerMessage body into the proper XML format
*/
static String encodeMessageBodyBase64(final Message message) throws Exception {
 Preconditions.checkNotNull(message, "ServerMessage can not be null");
 ActiveMQBuffer byteBuffer = message.toCore().getReadOnlyBodyBuffer();
 byte[] buffer = new byte[byteBuffer.writerIndex()];
 byteBuffer.readBytes(buffer);
 return XmlDataExporterUtil.encode(buffer);
}

代码示例来源:origin: org.apache.activemq/artemis-mqtt-protocol

@Override
public int sendMessage(MessageReference reference,
           Message message,
           ServerConsumer consumer,
           int deliveryCount) {
 try {
   session.getMqttPublishManager().sendMessage(message.toCore(), consumer, deliveryCount);
 } catch (Exception e) {
   log.warn("Unable to send message: " + message.getMessageID() + " Cause: " + e.getMessage(), e);
 }
 return 1;
}

代码示例来源:origin: apache/activemq-artemis

@Override
 public Map<String, Object> getFields(MessageReference ref) throws OpenDataException {
   Map<String, Object> rc = super.getFields(ref);
   ICoreMessage m = ref.getMessage().toCore();
   if (!m.isLargeMessage()) {
    SimpleString text = m.getReadOnlyBodyBuffer().readNullableSimpleString();
    rc.put(CompositeDataConstants.TEXT_BODY, text != null ? text.toString() : "");
   } else {
    rc.put(CompositeDataConstants.TEXT_BODY, "");
   }
   return rc;
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Used by ActiveMQ Artemis management service.
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception {
 SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString();
 String jsonString = (sstring == null) ? null : sstring.toString();
 if (jsonString != null) {
   JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
   return JsonUtil.fromJsonArray(jsonArray);
 } else {
   return null;
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Used by ActiveMQ Artemis management service.
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception {
 SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString();
 String jsonString = (sstring == null) ? null : sstring.toString();
 if (jsonString != null) {
   JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
   return JsonUtil.fromJsonArray(jsonArray);
 } else {
   return null;
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Used by ActiveMQ Artemis management service.
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception {
 SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString();
 String jsonString = (sstring == null) ? null : sstring.toString();
 if (jsonString != null) {
   JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
   return JsonUtil.fromJsonArray(jsonArray);
 } else {
   return null;
 }
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

/**
* Used by ActiveMQ Artemis management service.
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception {
 SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString();
 String jsonString = (sstring == null) ? null : sstring.toString();
 if (jsonString != null) {
   JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
   return JsonUtil.fromJsonArray(jsonArray);
 } else {
   return null;
 }
}

代码示例来源:origin: apache/activemq-artemis

private static Message asLargeMessage(Message message, StorageManager storageManager) throws Exception {
 ICoreMessage coreMessage = message.toCore();
 LargeServerMessage lsm = storageManager.createLargeMessage(storageManager.generateID(), coreMessage);
 ActiveMQBuffer buffer = coreMessage.getReadOnlyBodyBuffer();
 final int readableBytes = buffer.readableBytes();
 lsm.addBytes(buffer);
 lsm.releaseResources();
 lsm.putLongProperty(Message.HDR_LARGE_BODY_SIZE, readableBytes);
 return lsm;
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void copyHeadersAndProperties(final Message msg) {
 messageID = msg.getMessageID();
 address = msg.getAddressSimpleString();
 userID = (UUID) msg.getUserID();
 type = msg.toCore().getType();
 durable = msg.isDurable();
 expiration = msg.getExpiration();
 timestamp = msg.getTimestamp();
 priority = msg.getPriority();
 if (msg instanceof CoreMessage) {
   properties = ((CoreMessage) msg).getProperties();
 }
}

相关文章