【发布时间】:2021-02-16 03:56:21
【问题描述】:
我已经使用BrokerFilter 类实现了一个自定义 ActiveMQ 代理插件。我已经覆盖了如下所示的发送方法。
public void send(final ProducerBrokerExchange producerExchange, final Message messageSend) throws Exception {
logger.info("Message : " + messageSend);
// Returns the JMS Type of Mesage
logger.info("Message Type : " + messageSend.getType());
// Lookig for method to get the message text
?
}
第一行日志显示对象中的消息文本,但似乎没有可用的方法来获取消息文本。
INFO | Message : ActiveMQTextMessage {commandId = 5, responseRequired = false, messageId = ID:192.168.10.6-63132-1613444356003-4:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:192.168.10.6-63132-1613444356003-4:1:1:1, destination = topic://reporting, transactionId = null, expiration = 0, timestamp = 1613444364819, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = , replyTo = null, persistent = false, type = NewAgent, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, **text = Hello** }
INFO | getType : New
有人可以指导我使用适当的类或方法来获取/拦截消息文本吗?我的目标是获取消息文本/正文并将其存储在 redis 中。
【问题讨论】: